[BUG] ENABLE_TOOL_SEARCH not working in Desktop App - MCP tools fully loaded despite settings
Description
ENABLE_TOOL_SEARCH=true works correctly in Claude Code CLI (tools show as "loaded on-demand", 0 MCP token overhead), but has no effect in the Claude Code Desktop App on Windows. MCP tool schemas are fully injected into context regardless of the setting.
Environment
- Claude Code version: 2.1.88
- OS: Windows 11 Pro 10.0.26100
- Model: claude-opus-4-6 (1M context)
- MCP servers: Claude_in_Chrome (19 tools), Claude_Preview (13 tools), Desktop_Commander (22+ tools), mcp-registry (2 tools), claude-mem (7 tools), scheduled-tasks (3 tools)
Configuration
~/.claude/settings.json:
{
"env": {
"ENABLE_TOOL_SEARCH": "true"
}
}
Windows User-level environment variable also set:
[Environment]::SetEnvironmentVariable("ENABLE_TOOL_SEARCH", "true", "User")
Steps to Reproduce
- Set
ENABLE_TOOL_SEARCH=truein bothsettings.jsonenv field and as Windows User env var - Fully quit and restart Claude Code Desktop App
- Open a new conversation
- Run
/context
Expected Behavior (as seen in CLI)
MCP tools · /mcp (loaded on-demand)
Total: 18.5k tokens
CLI correctly defers all MCP tools. No individual tool token counts are shown.
Actual Behavior (Desktop App)
MCP tools: 22.2k tokens (2.2%)
All 66 MCP tools are listed with individual token counts, fully loaded with complete JSON schemas. The ENABLE_TOOL_SEARCH environment variable inside the Desktop App process reads as auto instead of true:
$ echo $ENABLE_TOOL_SEARCH
auto
This confirms the Desktop App is not reading the settings.json env field or the system environment variable.
Additional Evidence
- The model's system prompt lists tools under "deferred tools available via ToolSearch", but the actual tool schemas are still fully injected (the model can see complete parameter details without searching)
- Same
settings.jsonfile, same machine, same user — CLI works, Desktop App doesn't - Restarting the Desktop App, logging out/in to Windows, and restarting explorer.exe were all attempted — none resolved the issue
Impact
22.2k tokens wasted per conversation on a 1M context model. On 200k models this would be ~11% of context consumed before any user interaction.
Related Issues
- #25892 - "Tool Access" / "On Demand" setting does not persist or defer tools (closed as NOT_PLANNED, but was about Claude Desktop consumer app, not Claude Code Desktop App)
- #11927 - env vars from settings.json not passed to plugins/MCPs
- #20112 - Environment variables from settings.json not injected on Windows
- #19890 - ENABLE_TOOL_SEARCH auto mode not triggering despite exceeding threshold
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗