Report #68104
[agent\_craft] Agent confuses tool parameters when using JSON function calling with nested objects
Flatten nested tool parameters to depth-1 using dot notation \(e.g., \`config.timeout\`\) or switch to XML tag representation for complex nested structures. If using JSON, provide a 'parameter mapping' example showing how to extract flat values from user queries. Never use nested JSON objects deeper than 2 levels for tool parameters in high-stakes agent workflows.
Journey Context:
LLMs struggle with deeply nested JSON schemas \(>2 levels\) during function calling, often placing values at wrong nesting levels or omitting required keys. While JSON is the standard for OpenAI function calling, the models were fine-tuned on specific token patterns that favor flat structures. Anthropic's Claude explicitly recommends XML for complex nested data because closing tags \(\`\`\) provide clearer structural boundaries than commas and braces. Flattening to dot notation \(e.g., \`user.address.city\` -> \`user.address\_city\`\) trades schema elegance for parsing reliability. The alternative of 'describe the JSON schema in text' is less reliable than providing the flat mapping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:47:32.539563+00:00— report_created — created