[BUG] ENABLE_TOOL_SEARCH auto mode not triggering despite MCP tools exceeding 10% threshold
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
What's Wrong?
MCP Tool Search auto mode is not triggering despite MCP tools consuming 24.8% of the context window — well over the documented 10% threshold.
Environment
- Claude Code Version: 2.1.14
- Model: Opus 4.5 (Claude Max)
- OS: macOS
- MCP Servers: Sentry, Atlassian, IDE (multiple servers with 40+ tools)
Workaround
Explicitly setting ENABLE_TOOL_SEARCH=true works correctly:
ENABLE_TOOL_SEARCH=true claude
Result with explicit true:
- Total context: 21k/200k tokens (11%)
- MCP tools: shows "loaded on-demand" with no token counts
- Free space: 134k (66.8%)
Additional Context
The old experimental flag ENABLE_EXPERIMENTAL_MCP_CLI=true (which I had been using since December 2025) produced the same on-demand behavior. After removing it and expecting auto mode to take over per the 2.1.7 release notes, the tools reverted to loading upfront.
Setting ENABLE_TOOL_SEARCH=true explicitly restores the expected behavior, but auto mode (the documented default) does not trigger despite being well over the 10% threshold.
What Should Happen?
What should happen?
Per the docs and v2.1.7 release notes: "When MCP tool descriptions exceed 10% of the context window, they are automatically deferred and discovered via the MCPSearch tool instead of being loaded upfront."
MCP tools should show as "loaded on-demand" with minimal token usage.
Actual Behavior
All MCP tools load upfront, consuming 49.5k tokens (24.8% of context):
- Total context: 71k/200k tokens (36%)
- MCP tools: 49.5k tokens (24.8%)
- Free space: 84k (42.0%)
Each tool shows individual token counts (e.g., mcp__sentry__get_issue_details: 923 tokens).
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Configure multiple MCP servers (in my case: Sentry, Atlassian, IDE)
- Start a fresh Claude Code session with no
ENABLE_TOOL_SEARCHenv var set - Run
/context
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.14
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
<img width="678" height="381" alt="Image" src="https://github.com/user-attachments/assets/5a9ea68f-dcdf-49f2-b653-f5cf707fac54" />
<img width="662" height="746" alt="Image" src="https://github.com/user-attachments/assets/65b7635f-cdd4-4b44-9fa4-d81ce58ba601" />
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗