Claude Code MCP tool search: deferred loading and thresholds
Separate connection from definition loading; inspect ENABLE_TOOL_SEARCH, thresholds and gateway compatibility before diagnosing disconnection.
Three values select different loading behavior · Deferral can persist below the threshold · Models and gateways set compatibility boundaries
At a glance
The goal is to explain an MCP connection whose tool definitions are not all in context. The official MCP page was checked and original environment-value fixtures inspected. No MCP service, Claude Code session or gateway was called; model and version prerequisites follow that page.
Runtime and applicability
- Article type
- Spec file
- Verified
- Applies to
- Claude Code Applies to Claude Code as documented; version, model and environment prerequisites are stated in the body.
- Tools
File locations
| Path | Scope | How it is read |
|---|---|---|
启动环境中的 ENABLE_TOOL_SEARCH / ENABLE_TOOL_SEARCH in the launch environment | Claude Code MCP definition loading behavior, not a server authentication field. | The session reads the environment value; tools load upfront or are discovered on demand according to the mode. |
When to use
- When inspecting tool-definition context usage or distinguishing deferred loading from connection failure.
When not to use
- If authentication, network connection or model support is unverified, resolve those prerequisites; a threshold is not a compatibility fix.
Three values select different loading behavior
The current docs say tool search is enabled by default and MCP tools are discovered on demand. true also defers loading; false loads all tools upfront. auto loads otherwise-deferred definitions upfront below 10% of context and enables search at or above that threshold. auto:N accepts a percentage from 0 to 100. Unset and true have model and serving-platform fallback conditions, so they cannot be generalized to every deployment.
Deferral can persist below the threshold
The docs say that after tool search activates in a conversation, tools may remain deferred or loaded on-demand even if total definitions later shrink. They load when needed, so a low current percentage alone does not establish misconfiguration. A server entry’s alwaysLoad: true can load its tools without search, subject to tool metadata and version rules. No existing MCP configuration was changed here.
Models and gateways set compatibility boundaries
The page distinguishes support by model and serving platform: older models load upfront, and ENABLE_TOOL_SEARCH=true does not override lack of support. Gateways need to forward defer_loading, tool_reference and the paired anthropic-beta header. Gateway defaults differ before v2.1.304; from v2.1.305, requests may retry without tool search after 400 or 422. That retry does not widen tool permissions or establish compatibility of every gateway.
Inspect connection, loading and invocation in order
Inspect MCP connection and authentication first, definition loading with /context second, and a harmless invocation last. Only local parsing of values such as auto:5 and a 10% threshold model were checked; context measurement, connection and invocation were not verified. The docs also state restrictions for disabled experimental capabilities and HIPAA configurations; ENABLE_TOOL_SEARCH cannot bypass those boundaries. Stop changing settings on a mismatch, record version, model, platform and error, then inspect the relevant official section.
Sources
All links are official pages; verification dates are listed per source, and links point to the version checked.