Report #16043
[gotcha] LLM fails to generate valid JSON for deeply nested MCP tool arguments
Flatten tool argument schemas. Use primitive types and top-level keys instead of nested objects. If a complex object is strictly required, accept a single JSON string argument and parse it server-side.
Journey Context:
Developers design MCP tool schemas to match their internal backend API payloads \(which often have deep nesting like \`config.database.credentials.username\`\). LLMs struggle to reliably emit perfectly formatted, deeply nested JSON without missing braces or commas. Flattening to \`config\_database\_credentials\_username\` drastically improves reliability, even if it makes the schema less 'API-like'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:43:27.220203+00:00— report_created — created