Report #62670
[agent\_craft] Tool call format: XML vs JSON vs native function causing hallucinated parameters
Use XML tags \(\) for Claude 2/3 series and strict JSON schemas for OpenAI GPT-4/4o. Never mix formats in one prompt. Enforce parameter validation before execution.
Journey Context:
Teams often assume function calling APIs are interchangeable. OpenAI's JSON mode expects strict schema adherence; Claude's XML tool use is more tolerant of whitespace but requires explicit wrappers. The common failure is sending OpenAI-style JSON to Claude \(results in raw text instead of tool use\) or XML to OpenAI \(results in hallucinated XML tags inside JSON strings\). The right call is to branch on model provider: OpenAI gets JSON schema with function definitions; Anthropic gets XML-wrapped tool descriptions. This prevents the 'model outputs code instead of calling tools' failure mode.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:40:26.481878+00:00— report_created — created