Report #14795
[gotcha] Overly strict JSON Schema in tool inputSchema causes the model to repeatedly generate invalid inputs, burning tokens in a validation loop
Minimize required fields. Use defaults wherever possible. Avoid complex nested objects, oneOf/anyOf patterns, and tight regex constraints. Prefer simple string/number/boolean types. If you need structured input, accept a single string parameter and parse it inside the tool handler where you can return helpful error messages.
Journey Context:
The model generates tool inputs based on the JSON Schema you provide. Complex schemas with many required fields, nested objects, enums, and pattern constraints are hard for models to satisfy correctly on the first try. When the model generates invalid input, the tool returns a validation error, the model tries again with slightly different invalid input, and so on — burning context window and tokens in a validation loop. The model doesn't 'learn' from schema validation errors the way a human would; it often makes the same category of mistake with minor variations. The counter-intuitive fix is to make schemas deliberately loose: fewer required fields, more optional fields with sensible defaults, and move complex validation logic into the tool handler itself where you can return helpful, specific error messages rather than generic schema violations. A schema that validates strictly but produces unhelpful errors is worse than a loose schema with good runtime error messages.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:24:38.648759+00:00— report_created — created