Skip to content

Translated route drops tool_reference blocks from tool results, so ToolSearch returns empty and routed models call it in a loop #6647

Closed

Description

@rhomat27

Client or integration

Claude Code

Area

Tools / MCP / web search

Summary

Claude Code's ToolSearch tool answers with a tool_result whose content is only tool_reference blocks ([{"type":"tool_reference","tool_name":"Bash"}, …]). On the translated Claude Messages → Responses route, toolResultOutput in src/claude/inbound.ts keeps text, image and document items and drops everything else, so the routed model receives an empty function_call_output for every ToolSearch call. It concludes the tools did not load and calls ToolSearch again; one subagent made 26 ToolSearch calls in 9 minutes, restarting its plan after each.

Expected: the routed model sees which tools were loaded, as it does for any other tool result. src/claude/compatibility.ts already lists tool_reference as a supported result block type, so the translation is expected to carry it.

When it happens. Claude Code only keeps tool search on when it believes it is talking to Anthropic. That is the case in the first-party desktop intercept mode (desktopMode: "first-party"), where ANTHROPIC_BASE_URL is not set. #4838 covers the opposite configuration (gateway mode turns tool search off). In first-party mode the deferral stays on and tool_reference results do flow through the translation, where they are dropped.

Fix that works here. In toolResultOutput, map a tool_reference item to text:

} else if (item.type === "tool_reference" && typeof item.tool_name === "string") {
  out.push({ type: "input_text", text: `Tool loaded: ${item.tool_name}` });
}

With that one branch the routed model loads its tools once and moves on.

Reproduction

  1. Run opencodex with a Claude Code route translated to a Responses model (here a combo whose first member is meta-muse/muse-spark-1.3-contributor).
  2. POST /v1/messages with a history containing an assistant tool_use for ToolSearch (input {"query":"select:WebFetch"}), followed by a user tool_result for it with content [{"type":"tool_reference","tool_name":"WebFetch"}], then a user text message: Repeat the tool result you received, verbatim.
  3. Observe: the model reports an empty tool result. With the fix above, it answers Tool loaded: WebFetch.

Version

2.76.0 (also present in 2.78.0-preview.20261005)

Operating system

macOS 26.6.2 (arm64); also macOS 26.7.1 (arm64)

Provider and model

meta-muse / muse-spark-1.3-contributor (via combo); not provider-specific, the drop happens before routing

Logs or error output

No response

Screenshots and supporting files

No response

Redacted configuration

No response

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. github-actions commented on Oct 5, 2026

    @github-actions
    Contributor

    Issue reopened

    The report now contains the information required by the automated check. Thanks for updating it.

  2. added
    bugSomething isn't working
    toolstool_calls, MCP, web-search / sidecar tools
    on Oct 5, 2026
  3. Ingwannu commented on Oct 6, 2026

    @Ingwannu
    Owner

    Prepared draft #6660 at 502b6e38fb6a0b46f51b84ab8e8f0a36b13f0a8f, based on current dev f924820652. The unchanged-source regression produced 1 pass/2 fail, confirming the missing reference-only and mixed-content result blocks. The fix passes 140 tests across six focused translation/layout files and the structure check.

    This preserves loaded-name evidence in the paired result without adding tool declarations or enabling translated server-side deferral. Typecheck reached the strict 180-second resource deadline and remains unverified; full/import-connected coverage, docs build and required current-head CI/review are still outstanding. The PR therefore stays Draft. No live provider request, installed-client operation or security/privacy scan was performed, and no release or live-loop resolution is claimed. Keeping this issue open until the fix is accepted and lands.

  4. lidge-jun commented on Oct 6, 2026

    @lidge-jun
    Owner

    Fixed on dev by #6660 (merge aed4f1c): translated Claude routes now carry tool_reference results as 'Tool loaded: ' lines, so ToolSearch no longer returns empty output. It ships with the next release cut from dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtoolstool_calls, MCP, web-search / sidecar tools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions