Report #90212
[agent\_craft] Agent generates malformed tool calls despite correct user instructions
Use XML tags in system prompt for tool definitions when using Claude/Anthropic models; wrap tool schemas in blocks with explicit tags rather than raw JSON schema.
Journey Context:
Raw JSON schemas in system prompts cause Claude to hallucinate closing braces or mix up nested parameters. XML tag structure aligns with the model's training on markup languages, reducing syntax errors by forcing explicit opening/closing delimiters. This is distinct from OpenAI's function calling which uses JSON schema natively.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:00:52.231088+00:00— report_created — created