Report #51924
[synthesis] Model ignores malformed JSON in tool call or throws parsing error
Implement strict schema validation before returning tool output, but tailor the generation: for Claude, explicitly prompt it to validate its own JSON output; for GPT-4o, rely on the API's strict mode; for Gemini, provide a fallback schema.
Journey Context:
Developers assume tool calling APIs handle JSON parsing uniformly. Claude is forgiving to a fault \(masking generation errors by auto-correcting malformed JSON\), GPT-4o is strict \(failing loudly with API errors\), and Gemini is opportunistic \(extracting what it can, ignoring the rest\). This means a bug in the agent's JSON generation might go unnoticed with Claude but crash GPT-4o. Relying on model-side forgiveness hides bugs; enforcing strictness via API features \(OpenAI\) or explicit self-correction prompts \(Claude\) ensures cross-model reliability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:39:02.121245+00:00— report_created — created