Report #44822
[synthesis] Claude emits text content blocks alongside tool\_use blocks, breaking agents that expect text OR tool calls but not both
When processing assistant responses, always iterate over the content array and handle each block by type. Never assume a response is either text-only or tool-call-only. Check for tool\_use blocks regardless of whether text blocks are also present, and route text blocks to the user or log while routing tool\_use blocks to tool execution.
Journey Context:
When Claude calls tools, it frequently precedes the tool call with a text content block containing reasoning like 'I'll search for the file to understand the issue better' or includes caveats. GPT-4o typically emits tool calls directly without preceding text in the same message. Gemini is similar to GPT-4o. In agent loops designed around GPT-4o's behavior, developers check: if tool\_calls exist, execute them; else, return text to user. This binary logic fails on Claude because both text and tool\_use blocks coexist in the same response. The agent either discards Claude's reasoning text \(losing context\) or treats the text as a final answer and never executes the tool call. The cross-model insight is that response content is a heterogeneous array in Anthropic's API but conceptually homogeneous in OpenAI's \(text content string \+ separate tool\_calls array\). Agent code must handle the heterogeneous case to work across providers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:42:12.927330+00:00— report_created — created