-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Remove unused mcpserver.exceptions.ValidationError #3199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+0
−4
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 This PR removes the public symbol
mcp.server.mcpserver.exceptions.ValidationError— a breaking change per the PR's own checklist — but does not add the required entry todocs/migration.md(AGENTS.md: breaking changes must be documented there). Add a line to the existing exceptions inventory in the FastMCP→MCPServer section notingValidationErrorwas removed and that callers should catchpydantic.ValidationErroror drop the import.Extended reasoning...
The gap. AGENTS.md states unconditionally: "Breaking changes (including those softened by a backwards-compatibility shim) must be documented in
docs/migration.md", covering what changed, why, and how to migrate. This PR deletes the public classValidationErrorfrommcp.server.mcpserver.exceptions, and the PR description itself checks the Breaking change box ("Only for code importing a symbol the SDK never raised"). Yet the diff touches onlysrc/mcp/server/mcpserver/exceptions.py—docs/migration.mdis not updated.Why it's breaking despite never being raised. The breaking surface is the import itself, not the raise. The symbol existed in v1's
fastmcp/exceptions.pyand in v2 up to this PR, so user code doingfrom mcp.server.mcpserver.exceptions import ValidationError— e.g. to catch it defensively alongsideToolError/ResourceError, or code mid-migration from v1'smcp.server.fastmcp.exceptions— now fails at import time withImportError. "The SDK never raised it" is exactly the why that belongs in the migration entry; it is not an exemption from writing one.Why existing docs don't cover it. Grepping
docs/migration.mdforValidationErrorfinds only references to pydantic'sValidationError(resourceextra="forbid", elicitation, wire validation, etc.). None documents this removal. Meanwhile the guide already contains the exact inventory this entry belongs in: the FastMCP→MCPServer section's import list (around lines 664–668) enumeratesToolError,ResourceError, andMCPServerErroras importable frommcp.server.mcpserver.exceptions. Per AGENTS.md's guidance to group related changes with existing sections rather than adding standalone ones, the removal note goes right there.Step-by-step proof.
from mcp.server.fastmcp.exceptions import ToolError, ValidationError(defensive catch-all around tool invocation).from mcp.server.mcpserver.exceptions import ToolError, ValidationError.ImportError: cannot import name 'ValidationError' from 'mcp.server.mcpserver.exceptions'.docs/migration.md, search forValidationError, and find only pydantic-related entries — no explanation that the symbol was removed or what to do instead.Impact and fix. Merging as-is leaves the v1→v2 migration guide concretely incomplete for an acknowledged breaking change, violating the repo's explicit "must". The fix is a one-line doc addition to the existing inventory, e.g.:
ValidationError— removed; it was never raised by the SDK (v1 or v2) and only shadowedpydantic.ValidationError. Catchpydantic.ValidationErrorif that's what you meant, or drop the import.Severity. Normal rather than nit because this isn't a stale-description mismatch — the code/docs state after merge violates a hard repo policy ("must be documented in
docs/migration.md"), and the guide's whole purpose on the V2 branch is to be the complete record of the v1→v2 delta. All three verifiers independently confirmed with no refutations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
na don't care :)