Report #65321
[agent\_craft] Model generates malformed tool calls or JSON with escape errors when using native tool schemas
Define tools in the system prompt using strict XML tags \(e.g., ......\) rather than JSON Schema blobs, and wrap actual tool calls the model generates in blocks
Journey Context:
Anthropic's models \(Claude\) are fine-tuned on XML-based tool formats, while OpenAI uses JSON. When agents use Claude with JSON tool definitions, accuracy drops 15-20% on nested parameter structures. XML reduces token count for schema definition and aligns with the model's pre-training. Alternative is to use the native 'tools' API, but for prompt-based agents \(no API tool support\), XML in system prompt is the robust pattern.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:07:17.430306+00:00— report_created — created