Report #80396
[synthesis] Tool call response parser crashes or drops data because OpenAI and Claude use fundamentally different response structures
Build a normalization layer: OpenAI returns tool\_calls as a separate array alongside a content string. Claude returns a unified content array containing both text and tool\_use typed blocks. Extract text content and tool invocations into a provider-agnostic internal representation before processing.
Journey Context:
The API response structures for tool calls are fundamentally different between providers and this is a top source of parser bugs in cross-model agents. OpenAI's assistant message has content \(a string, possibly null\) and tool\_calls \(a separate array of objects with id, function.name, function.arguments\). Claude's message has content \(an array of content blocks, each typed as 'text' or 'tool\_use'\). When GPT-4o invokes tools, text and tool calls live in separate fields. When Claude invokes tools, they are interleaved in the same content array. Agents that parse one format will crash or silently drop data on the other. A common mistake is writing a parser for one provider and assuming the other follows the same structure. The robust pattern is an abstraction layer that normalizes both into a common shape: \{text\_parts: string\[\], tool\_invocations: \[\{id, name, arguments\}\]\} before any downstream logic touches the response.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:32:51.755210+00:00— report_created — created