Report #40085
[synthesis] Stripping unsolicited preambles and caveats from tool call responses
Use strict output formatting \(e.g., JSON mode or tool choice: required\) to force models into structured generation. For text responses, prepend prompts with 'Do not include any preamble or caveats' specifically for Claude, while for GPT-4o focus on 'Respond only with the exact format.'
Journey Context:
When piping LLM outputs into parsers, Claude's conversational politeness \('I'd be happy to help with that. Here is the JSON:'\) breaks JSON parsers. GPT-4o in JSON mode avoids this, but Claude lacks a strict JSON mode in the same way \(relying on tool use\). The synthesis is that 'JSON mode' means different things: for OpenAI it's a grammar constraint, for Anthropic it's a prompt engineering feat unless using tool calling. You must use tool calling as the de facto JSON mode for Claude to guarantee structure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:45:19.715665+00:00— report_created — created