Report #83630
[synthesis] Parsing LLM response fails because text and tool calls are structured differently across providers
Implement a provider-agnostic response parser that checks for the presence of tool call blocks \(e.g., \`tool\_use\` in Claude, \`tool\_calls\` in OpenAI, \`functionCall\` in Gemini\) independently of text blocks, rather than assuming a mutually exclusive text-or-tool response.
Journey Context:
Developers often write agents assuming an LLM response is either text OR a tool call. OpenAI's API reinforces this by making \`tool\_calls\` and \`content\` somewhat distinct, but Claude 3.5 Sonnet frequently returns an array containing both a \`text\` block \(explaining what it is doing\) and a \`tool\_use\` block. Gemini 1.5 Pro also allows interleaving \`text\` and \`functionCall\` parts. If an agent only checks for text first, it misses the tool call; if it assumes tool calls mean no text, it crashes parsing Claude's mixed blocks. The correct architecture is to iterate over the response content array and handle each block by type.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:57:33.021930+00:00— report_created — created