Repository navigation
fix(server): rebuild tool argument errors instead of echoing pydantic's - #6107
Merged
zzstoatzz merged 4 commits intoNov 10, 2026
Merged
Conversation
When `tools/call` fails argument validation the server re-raised the pydantic error, so `str(ValidationError)` reached the caller with the exact pydantic version URL (`https://errors.pydantic.dev/2.14/v/...`), the internal adapter name (`call[echo]`) and every submitted value with its inferred type. Server-side logging already avoids all of that (PrefectHQ#5106); the response did not. Rebuild the client-facing message from the error details without the URL, context or inputs: one line per invalid argument with its location, the reason, and the tool name. The caller still learns which argument failed and why, and the warning log is unchanged.
This comment has been minimized.
This comment has been minimized.
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 13fd91b5a6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzstoatzz
added a commit
that referenced
this pull request
Nov 10, 2026
* Revert "fix: preserve referenced schema definitions (#5588)" This reverts commit 5f1d152. * Revert "fix(server): rebuild tool argument errors instead of echoing pydantic's (#6107)" This reverts commit 8fba5f7. * Revert "Advertise the MCP Apps extension only when the server serves an app (#5062)" This reverts commit b89222b. * Revert "fix(tasks): retain results after tool removal (#5507)" This reverts commit 711575a. * Revert "fix(client): Prevent stale ClientGroup refreshes from replacing newer routes (#5543)" This reverts commit 365d5d2. * Revert "fix(prompts): honor field aliases when rendering prompts (#5836)" This reverts commit a450fd8. * Revert "Stop FastMCP callable caches from retaining dropped tools (#6147)" This reverts commit 713f247. * Revert "feat(auth): Add KeystoneTokenVerifier (#6264)" This reverts commit c33f3de. * Revert "fix(json-schema): keep x-unsupported-pattern when a format is set (#5731)" This reverts commit dc9849d. * Revert "Roll back the tool stamp when a tool registration is rejected (#5798)" This reverts commit d6566c5. * Revert "fix(server): validate cursors when pagination is disabled (#6045)" This reverts commit 4917bee. * Revert "Keep constraints on scalar schema references (#6041)" This reverts commit e5176c9.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #6099
When a
tools/callfails argument validation the server re-raised the pydantic error, sostr(ValidationError)reached the caller with the exact pydantic version URL (https://errors.pydantic.dev/2.14/v/string_type), the internal adapter name (call[echo]), and every submitted value with its inferred type. Server-side logging already avoids all of that (#5106); the response did not.Change
fastmcp_slim/fastmcp/server/server.py_validation_error_message(tool_name, error)rebuilds the client-facing text fromerror.errors(include_url=False, include_context=False, include_input=False): one line per invalid argument with its location and reason, prefixed by the tool name.ToolErrorwith that message instead of re-raising the pydantic error. The warning log (_validation_error_summary) is unchanged.Before:
After:
Tests
tests/server/test_input_validation.pytest_client_error_omits_pydantic_detailsdrives the issue's repro and asserts the field/reason lines are present whileerrors.pydantic.dev,call[,input_value,input_typeandN validation errors forare absent.test_validation_logs_omit_client_datapreviously asserted the client still received the raw values; it now asserts the caller learns which argument failed without the pydantic internals, while the log assertions are unchanged.Verified:
pytest tests/server/test_input_validation.py -q-> 54 passed; with onlyserver.pyreverted, 7 failed (the six log/client parametrizations and the new test).ruff checkreports only the two pre-existing findings in untouched code (PYI041on theset_instructionssignature and the string-concat finding at line 2046), andruff formatis clean on both changed files.