Report #59820
[gotcha] Agent hallucinates required parameters or fails to call a tool because its JSON schema uses anyOf, oneOf, or deeply nested objects
Flatten tool schemas to primitive types. Use simple strings or enums instead of complex nested objects. If a complex object is needed, have the tool accept a JSON string and parse it server-side.
Journey Context:
LLMs struggle to reliably generate valid JSON conforming to highly complex schemas like anyOf. They often omit required nested fields or mix up types. Developers design schemas for other developers, but LLMs need schemas optimized for token prediction. Flattening the schema or accepting a serialized string drastically reduces generation errors and improves tool-selection accuracy.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:53:40.220908+00:00— report_created — created