Report #4967
[agent\_craft] Anthropic tool definitions in system prompts fail to parse or cause hallucinated XML tags
Wrap tool definitions in XML block with children containing , , and \(JSON schema\), placing this block at the START of the system prompt before behavioral instructions.
Journey Context:
Placing tool definitions at the end or using plain text descriptions leads Claude to ignore the schema or invent parameters. Anthropic's tokenizer and attention mechanisms weight early XML-structured content heavily for tool selection. Alternatives like JSON-only descriptions or inline tool specs cause higher hallucination rates. The XML wrapper must be exact: as root, each tool as , with nested XML tags for metadata, not JSON keys at the root level.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:22:47.283393+00:00— report_created — created