You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add option to skip output validation for mcp client #2626
MCP Client session currently validates the output generated by MCP servers agains the reported json schema, and raises ValidationError.
This means that MCP server tools that have a not well maintained output schema, but are otherwise functional, are unusable.
The request is to add an option either at the ClientSession interface and/or the call_tool method so skip validation and return the result even if it does not conform to the output schemma
hey @germanbecker, would the right shape here be a validate_structured_output: bool = True kwarg on ClientSession.__init__? that's a one-flag gate at session.py:319-320 (only validation call site i can find), default true so nothing breaks for existing users.
noticed #1189 went down this road last fall and got closed over the safety-vs-flexibility tradeoff. the difference this time is the framing... real-world driver is servers shipping buggy output schemas that are otherwise functional, not a perf concern. happy to take it on if a maintainer (cc @felixweinberger) thinks the use case clears the bar. if not, totally fine to close.
Hey! Thanks for looking into this! yes I think either at the __init__ level or at the call_tool would work. As for the justification, my example is a tool where the schema has a list of literals for an output, but it appears the maintainers forgot one possible literal. Since this will eventually be a text stream sent to an LLM, in some applications (like my case) is better so send the output that doesn't conform to schema than send an empty error
Activity
ernestprovo23 commentedon May 22, 2026
hey @germanbecker, would the right shape here be a
validate_structured_output: bool = Truekwarg onClientSession.__init__? that's a one-flag gate at session.py:319-320 (only validation call site i can find), default true so nothing breaks for existing users.noticed #1189 went down this road last fall and got closed over the safety-vs-flexibility tradeoff. the difference this time is the framing... real-world driver is servers shipping buggy output schemas that are otherwise functional, not a perf concern. happy to take it on if a maintainer (cc @felixweinberger) thinks the use case clears the bar. if not, totally fine to close.
germanbecker commentedon May 23, 2026
Hey! Thanks for looking into this! yes I think either at the
__init__level or at thecall_toolwould work. As for the justification, my example is a tool where the schema has a list of literals for an output, but it appears the maintainers forgot one possible literal. Since this will eventually be a text stream sent to an LLM, in some applications (like my case) is better so send the output that doesn't conform to schema than send an empty errorgermanbecker commentedon May 23, 2026
For reference the current workaround: