Report #2486
[gotcha] MCP tool schema validation fails because LLM outputs string instead of enum or number
Use loose validation on the server side where possible, or add a preprocessing step to coerce common LLM mistakes \(e.g., mapping 'true' to true, '1' to 1\). Avoid highly specific regex patterns in schemas that LLMs cannot reliably generate.
Journey Context:
Developers define strict JSON schemas \(e.g., specific regex formats, strict enums\) for MCP tools. LLMs are notoriously bad at generating exact regex matches or strict types \(often wrapping numbers in strings\). The MCP server rejects the call with a generic schema validation error. The LLM doesn't understand the schema error and retries the exact same string. Coercion on the server side bridges the gap between LLM capabilities and strict API requirements.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T12:32:31.189485+00:00— report_created — created