[BUG] Desktop Code tab (3P/Bedrock) never defers MCP tools — tool search works in standalone CLI but not in the embedded Code engine

Resolved 💬 1 comment Opened Jun 12, 2026 by olafsozanski Closed Jun 15, 2026

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?

The Claude Code tab inside the Desktop app, running in third-party (Bedrock) inference mode, does not defer MCP tool definitions. Every connected MCP server's full schemas are loaded inline into context on every session, consuming a large fraction of the window before the first message.

The standalone Claude Code CLI, pointed at the same Bedrock account, region, model, MCP servers, and ~/.claude/settings.json, defers correctly — tool search engages and only a lightweight tool index loads up front. So Bedrock, the model, and the engine logic all support deferral here; the failure is specific to the Code tab embedded in Desktop in 3P mode.

What Should Happen?

The Desktop Code tab in 3P/Bedrock mode should behave identically to the standalone CLI on the same configuration: with ENABLE_TOOL_SEARCH unset or true, MCP tool definitions are marked defer_loading: true, only the tool index loads up front, and full schemas are pulled on demand via the tool search tool. The embedded engine should respect the same settings.json env values and negotiate the same tool-search-tool-2025-10-19 beta on its Bedrock InvokeModel path that the CLI already does successfully.

Error Messages/Logs

Steps to Reproduce

  1. Configure Bedrock 3P inference and confirm it's active: CLAUDE_CODE_USE_BEDROCK=1, region […], model [your model ID].
  2. Connect enough MCP servers that their combined tool definitions exceed ~10% of the context window. [List servers / approx tool count / token total — e.g. "6 servers, ~100 tools, ~50K tokens".]
  3. Set the env var in user settings:
json   // ~/.claude/settings.json
   { "env": { "ENABLE_TOOL_SEARCH": "true" } }

Control (standalone CLI): run against the same Bedrock config:

bash   CLAUDE_CODE_USE_BEDROCK=1 ENABLE_TOOL_SEARCH=true claude --debug
  1. Run /context. ✅ MCP tools are deferred — only a small tool index is loaded; the [ToolSearch…] debug line shows deferral active.
  2. Failing case (Desktop Code tab): open the Code tab in Claude Desktop in 3P/Bedrock mode, same MCP servers and settings, and start a session. Run /context. ❌ Full MCP schemas are loaded inline (large token count); deferral did not occur.

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.168

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗