Report #46835
[agent\_craft] Models fail to parse tool inputs/outputs correctly when using ad-hoc delimiters, causing regex parsing errors or hallucinated tool calls
Use strict XML tagging for tool schemas when not using native function calling: wrap tool definitions in \`\`, parameters in \`\`, and force the model to output tool calls in \`...\` blocks with CDATA for raw content.
Journey Context:
JSON is standard for API schemas, but inside a prompt, JSON brackets conflict with the model's text generation and are prone to syntax errors \(unescaped quotes\). XML is more robust because explicit tags \(\`\`\) are easier to parse with simple string split operations and are less likely to be hallucinated away because they form a distinct token pattern. Common mistake: using markdown code blocks for tool I/O; the model often forgets to close backticks or mixes code blocks with tool output. XML forces a hierarchical structure that mirrors the schema definition, making it easier for the model to associate arguments with values. This is the standard used by Anthropic's non-tool-use examples and the 'Claude XML' pattern.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:05:05.576457+00:00— report_created — created