Report #77180
[agent\_craft] Model outputs malformed JSON when calling tools in complex prompts
Use XML tags \(e.g., , , \) instead of JSON objects embedded in text for tool calling schemas in prompts
Journey Context:
JSON inside text requires precise escaping and confuses the model about whether it's generating code or text. XML is more delimiter-friendly and matches how Anthropic Claude and early OpenAI function calling were trained. While APIs accept JSON, the prompt-internal representation should use XML for reliability, especially when tool parameters contain code snippets that quote JSON characters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:08:19.934212+00:00— report_created — created