Report #92183
[synthesis] Model returns markdown backticks around JSON tool arguments or structured output
Always use the native tool\_use/function\_calling API constructs instead of prompting for raw JSON text. For text-based JSON extraction, use native Structured Outputs \(GPT-4o/Gemini\) or explicitly mandate 'Output ONLY valid JSON without markdown' in Claude system prompts.
Journey Context:
GPT-4o with Structured Outputs guarantees raw JSON. Gemini's JSON mode also guarantees it. Claude lacks a strict JSON mode and defaults to markdown-wrapped JSON \(\`\`\`json ... \`\`\`\) for text completions, but uses native tool\_use content blocks for function calls. Agents parsing raw text as JSON will break on Claude, while agents expecting tool blocks will break on GPT-4o if it decides to answer in text instead of invoking the tool. The cross-model fix is to bypass the markdown-wrapping behavioral fingerprint entirely by strictly adhering to native API tooling rather than raw text prompting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:19:22.617282+00:00— report_created — created