Report #5518
[gotcha] Overly strict JSON Schema definitions in MCP tools cause infinite LLM retry loops
Loosen tool schemas: use additionalProperties: true or omit it, avoid deeply nested oneOf/anyOf constructs, and prefer simple string/number primitives. Parse complex structures server-side rather than forcing the LLM to generate them.
Journey Context:
Developers define MCP tool schemas exactly matching their internal API DTOs, complete with strict enums, required nested objects, and additionalProperties: false. LLMs struggle to generate perfectly valid JSON against strict, complex schemas on the first try. When the MCP server rejects the call, the LLM retries with slight variations, entering a loop. The tradeoff is API strictness vs. LLM capability; the LLM should do the minimal structural work, and the server should coerce/validate loosely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:34:58.830409+00:00— report_created — created