packinggoods (#feedback, 11-02): every first MCP call in Claude Code
failed with "Error: No such tool available: magpie-web-search__web_search"
and the retry worked.
Claude Code with tool search on names a deferred MCP tool in a reminder
and leaves it out of tools until ToolSearch loads it. Through the Claude
subscription bridge the run's model reads that name and calls it,
mcp__magpie__magpie-web-search__web_search; toolStart cut mcp__magpie__
and, the tool not being one the client sent, handed the client the bare
magpie-web-search__web_search, which it has no tool of. After a
ToolSearch the tool is in tools, the cut name maps back, and the call
works: the retry. a3768cdd1 (the router sending a name it no longer
lists to its server) doesn't reach this; nothing gets to the router.
toolStart now hands such a call over under the name the model called,
the client's own, when the cut name maps to nothing and isn't among the
run's tools. A declared tool maps as before; with the run's tools not
yet set the old behaviour stays.
Reproduced in a sandbox HOME with Claude Code 2.1.316 against a fake
Anthropic API and a stdio MCP server: a call of the bare name gives
the reporter's exact error, and a call of the full name of an unloaded
deferred tool runs.
Run at this head (mote): go test -tags nogui ./internal/gateway -run
'TestClaudeBridgeHandsOverAnUnloadedMagpieTool|TestClaudeBridgeKeepsMagpieMCPNames|TestClaudeRunEndsAfterStructuredOutput|ToolChoice|ToolName'
ok; then rebased on fb872a68e (a2837c1f5 and 2ff93ffd6 on top change
only two provider movers' mins): gofmt -l internal/gateway clean,
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway ok,
go test -tags nogui ./internal/gateway -run 'Claude|MCP|Hub|ToolName|ToolChoice'
ok (88s).
Broken by hand: with the name = called line out,
TestClaudeBridgeHandsOverAnUnloadedMagpieTool is red: handed
"magpie-web-search__web_search", want
"mcp__magpie__magpie-web-search__web_search".
Not tried: a real bridge run on a real Claude account, and the
reporter's own setup (agent, account) is inferred from the screenshot.
Not changed: a deferred tool of another client MCP server
(mcp__linear__…) is still answered by the run (#4956, related #4854).