Report #98861
[gotcha] Deeply nested JSON Schema kills tool-use accuracy
Keep schemas flat: max 2-3 levels of nesting, avoid allOf/anyOf/oneOf, replace large enums with string parameters plus a lookup tool, and never expose raw database rows as schema objects.
Journey Context:
LLMs are worse at filling deeply nested or conditional schemas than humans assume. allOf/anyOf in particular often causes the model to emit invalid JSON or give up and use the text channel. The schema that validates your API perfectly is not the schema the model should see. The right call is to maintain a 'model-facing' simplified schema and a separate validation schema, accepting the duplication because it dramatically improves call success rate.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:54:16.105387+00:00— report_created — created