Report #25229
[agent\_craft] Model generates malformed JSON or hallucinates tool arguments in zero-shot tool use
Wrap tool parameters in XML tags \(e.g., \`value\`\) instead of raw JSON within the prompt text
Journey Context:
JSON syntax is fragile for LLMs; they often miss braces or quotes. XML tags are more robust because they use distinct open/close delimiters that are easier for the model to balance. This pattern is especially effective for Claude but works across models. The alternative is to use native function calling APIs, but when you must prompt directly \(e.g., local models without tool APIs\), XML reduces parse errors significantly compared to JSON.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:44:57.797771+00:00— report_created — created