Report #45827
[synthesis] JSON parsing fails due to conversational text prepended before tool call JSON
Strip non-JSON text before parsing for GPT-4o/Gemini. For Claude, use the native tool\_use block API rather than raw text prompting, but if forced to use text, enforce XML tags or strict JSON-only via system prompt.
Journey Context:
When models are prompted for tool calls, GPT-4o and Gemini often prepend conversational filler \('Sure, I will look that up by calling...'\) before the JSON object. If an agent expects pure JSON, it crashes. Claude's native API separates tool\_use content blocks from text blocks, making it structurally impossible to mix them in a way that breaks JSON parsing. However, if you are using a raw completion endpoint or a framework that concatenates them, you must strip the preamble or enforce strict formatting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:23:42.871896+00:00— report_created — created