fix(claude-code): disable built-in tools to prevent MCP tool deferral (#784)

This commit is contained in:
Maxim Kremmnev 2026-03-31 15:20:17 +03:00 committed by GitHub
parent 627ec5d524
commit fa82efc886
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -455,9 +455,14 @@ class ClaudeCodeLLM(LLMInterface):
# else: tool_choice == "auto" or unspecified - use default behavior (no changes needed) # else: tool_choice == "auto" or unspecified - use default behavior (no changes needed)
# Configure SDK options with MCP server # Configure SDK options with MCP server
# tools=[] disables built-in CLI tools (Read, Write, Bash, ToolSearch, etc.)
# Without this, Claude Code CLI defers MCP tools when too many built-in tools
# are loaded, forcing Claude to use ToolSearch first — which wastes the max_turns
# budget and prevents direct MCP tool calls.
options = ClaudeAgentOptions( options = ClaudeAgentOptions(
system_prompt=system_prompt if system_prompt else None, system_prompt=system_prompt if system_prompt else None,
max_turns=1, # Single-turn for API-style interactions tools=[], # Disable built-in tools so MCP tools load eagerly
max_turns=2, # Allow tool call + tool result round-trip
mcp_servers=mcp_servers_config, mcp_servers=mcp_servers_config,
allowed_tools=allowed_tool_names, allowed_tools=allowed_tool_names,
) )