Skip to content

feat(client): add validate_output flag to call_tool to skip output-schema revalidation - #3322

Open
RahilOp wants to merge 1 commit into
modelcontextprotocol:mainfrom
RahilOp:feat/2626-skip-output-validation
Open

feat(client): add validate_output flag to call_tool to skip output-schema revalidation#3322
RahilOp wants to merge 1 commit into
modelcontextprotocol:mainfrom
RahilOp:feat/2626-skip-output-validation

Conversation

@RahilOp

@RahilOp RahilOp commented Aug 17, 2026

Copy link
Copy Markdown

Fixes #2626.

This PR adds a validate_output: bool = True keyword argument to both ClientSession.call_tool() and the high-level Client.call_tool(). When set to False, the client skips revalidating the returned structured content against the tool's declared output schema, allowing callers to work with servers whose output schemas are incomplete or out of sync with the actual result.

Changes:

  • Added validate_output to all ClientSession.call_tool() overloads and the implementation.
  • Added validate_output to Client.call_tool() and threaded it through the InputRequired retry loop and the claimed-result resolver path.
  • Added regression test test_call_tool_validate_output_false_skips_validation.

Verified:

  • uv run --frozen pytest tests/client/test_output_schema_validation.py -xvs passes (6/6).
  • uv run --frozen ruff format and ruff check clean.
  • uv run --frozen pyright src/mcp/client/session.py src/mcp/client/client.py tests/client/test_output_schema_validation.py reports 0 errors.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to skip output validation for mcp client

2 participants