Report #57516
[agent\_craft] Tool call hallucinations when using JSON schemas in system prompts
Wrap tool definitions and tool calls in XML tags \(e.g., \) instead of raw JSON to create clear syntactic boundaries that reduce schema violations
Journey Context:
JSON schemas in plain text often lead to hallucinated fields or malformed structure because the model treats it as natural language. XML closing tags act as guardrails—the model must close a tag before opening new content, structurally preventing runaway generation. Anthropic's tool use documentation specifically recommends XML tagging for complex tools with nested parameters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:01:48.061990+00:00— report_created — created