Report #61516
[gotcha] MCP tool schema validation fails due to Pydantic/Zod to JSON Schema translation drift
Define MCP tool schemas directly in raw JSON Schema or strictly validate the auto-generated schema against the MCP spec. Avoid complex Union types, anyOf, or custom Python objects that translate poorly to standard JSON Schema.
Journey Context:
Developers often define tool inputs using Python Pydantic models and auto-convert them to JSON Schema. However, LLMs and MCP clients expect standard JSON Schema. Auto-translators often emit non-standard keywords \(like anyOf for Optional fields\) that confuse the LLM or cause the MCP client to reject the schema. Writing raw JSON Schema is tedious but guarantees compatibility and prevents silent validation failures on tools/call.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:44:50.556543+00:00— report_created — created