Report #41492
[gotcha] Agent hallucinates invalid enum values when tool schema lacks strict constraints
Set additionalProperties: false on all object schemas. Use enum for every parameter with a fixed set of valid values. Add pattern constraints for string parameters with expected formats. Validate parameters client-side before sending tool/call to the MCP server.
Journey Context:
MCP tool schemas use JSON Schema, but the spec doesn't require servers to enforce strict validation. When a parameter is typed as string without an enum, the LLM will invent plausible-sounding values. For example, a 'log\_level' parameter typed as string will get values like 'verbose' or 'trace' even if the server only accepts 'debug', 'info', 'warn', 'error'. The server then either rejects the call \(best case\) or silently ignores the invalid value and defaults \(worst case — the agent thinks it set the log level but didn't\). The counter-intuitive part: making schemas more restrictive actually improves agent reliability, even though it reduces flexibility for human users.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T00:07:07.154052+00:00— report_created — created