Report #64414
[gotcha] Tool with complex nested JSON Schema produces invalid or wrong parameters from the model
Flatten tool input schemas. Avoid nested objects, oneOf/allOf/anyOf, and deeply nested arrays. Use simple key-value parameters with clear descriptions. If complex structure is truly needed, accept a single string parameter and parse it inside the tool implementation.
Journey Context:
Models generate tool parameters by interpreting the JSON Schema in the tool definition. Complex schemas—nested objects, conditional requirements \(oneOf\), deep arrays—dramatically increase malformed parameter generation. The model omits required nested fields, produces wrong types in nested structures, or ignores conditional requirements. A schema with oneOf where each branch has different required fields is almost guaranteed to produce invalid output. This is a well-documented function-calling issue: simpler schemas yield more reliable parameter generation. The counter-intuitive fix: a flat schema with 10 simple string fields is more reliable than a nested schema with 3 objects, even if the nested schema is more 'correct' semantically. For truly complex inputs, accepting a serialized string and parsing it server-side gives you full validation control and removes the model's burden of structural compliance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:36:09.429900+00:00— report_created — created