Report #88741
[agent\_craft] Tool call generation fails or produces malformed arguments when using JSON mode versus XML-like tags
Use native tool calling schemas \(OpenAI functions/Anthropic tool\_use\) rather than injecting JSON/XML into the prompt text; if forced to manual format, use XML tags for Claude and strict JSON for GPT-4, never mix.
Journey Context:
Developers often manually inject 'tools' into system prompts as JSON blobs, leading to parsing errors. Native tool calling APIs use special tokens/formatting that constrain the model's output grammar, reducing hallucination. The tradeoff is vendor lock-in vs. portability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T07:32:19.591971+00:00— report_created — created