Skip to content

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

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

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

@github-actions github-actions Bot added the missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md) label Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This repository only keeps pull requests open when they're linked to an issue that a maintainer has assigned to the author — CONTRIBUTING.md explains why and how we work. This PR has been closed for now because you aren't currently assigned to #2626.

If a maintainer would like this change as a PR from you, they'll assign you to #2626 and this PR will reopen automatically — there's nothing more you need to do. (If you opened the issue, this PR already shows up on its timeline.)

There's no need to open a new PR — this one will be reopened. While it's closed, please push any updates as new commits rather than force-pushing, since GitHub can't reopen a PR whose branch has been rewritten.

Maintainers: reopening this PR, removing the missing-issue-link label, or adding bypass-issue-check bypasses the check.

@github-actions github-actions Bot closed this Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to skip output validation for mcp client

2 participants