Report #72407
[synthesis] Tool call response includes unexpected prose or markdown wrapping that breaks parsing
Always parse tool calls from the API response's structured tool\_calls/function\_call object, never from the text content field. For Claude, be aware that text content and tool\_use blocks coexist in the same content array—iterate and filter by type. For GPT-4o, tool\_calls appear in a separate top-level array on the assistant message. For Gemini, functionCall is a nested object. Never regex-parse the text body for tool invocations.
Journey Context:
A subtle but critical difference: Claude frequently generates both text content \(explanatory preamble like 'I'll search for that'\) AND tool\_use blocks in the same response. GPT-4o more often either calls tools with minimal text or generates text alone. Developers who parse the text field looking for tool-call-like patterns, or who assume text content is empty when tools are called, will break on Claude. The synthesis: the coexistence of prose and tool calls in a single response is a model-specific behavioral fingerprint. Claude was trained to narrate its tool use; GPT-4o was trained to be more telegraphic. Your parser must handle both patterns and must use the structured API fields, not the text.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T04:07:06.749390+00:00— report_created — created