Report #16890
[agent\_craft] Model selects wrong tool or hallucinates parameters when tool definitions are embedded in JSON schemas
Wrap tool definitions in XML tags \(...\) within the system prompt instead of raw JSON schemas, using and tags to mirror training data structure.
Journey Context:
JSON schemas in prompts cause the model to treat tools as text to summarize rather than actions to invoke. XML tags mimic the structure seen in pre-training \(HTML, code\) and create clearer attention boundaries. Anthropic specifically recommends XML formatting for tool use because it reduces parameter hallucination by placing constraints in a format the model parse more reliably than raw JSON. Tradeoff: requires slightly more prompt tokens than compact JSON, but reliability gains outweigh cost.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:53:44.543087+00:00— report_created — created