Repository navigation
feat(server): add tools-call-input-validation scenario (SEP-1303) - #589
Open
Ahmad-Faraj wants to merge 2 commits into
Open
Ahmad-Faraj wants to merge 2 commits into
Ahmad-Faraj wants to merge 2 commits into
Conversation
Servers MUST validate all tool inputs (server/tools, security considerations), and since 2025-11-25 input validation errors are tool execution errors reported with isError: true. No scenario sent arguments that violate a tool's inputSchema. The scenario calls a new everything-server fixture, test_input_validation (required integer 1-10), once with valid arguments as a control and then with a wrong type, a missing required property and an out-of-range value: - tools-call-input-validation-valid: the valid call returns a text result - sep-1303-input-validation-rejected (FAILURE, MUST): no invalid call executes; an isError result or a JSON-RPC error both pass - sep-1303-input-validation-tool-error (WARNING, keyword-less): each rejection is an isError result with text content Adds a low-level-Server negative example with a vitest case, and src/seps/sep-1303.yaml. Closes modelcontextprotocol#588 Signed-off-by: Ahmad Faraj <ahmedfrag4040@gmail.com>
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9488899a49
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…rors An isError result may carry image, audio or resource content; requiring a text block made sep-1303-input-validation-tool-error warn on valid tool execution errors. Signed-off-by: Ahmad Faraj <ahmedfrag4040@gmail.com>
This branch has not been deployed
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.
Closes #588. Adds a server scenario for SEP-1303 and the security requirement that servers MUST "Validate all tool inputs" (
server/tools, 2025-11-25 and draft). Shape and questions are in #588; happy to adjust.What it adds
src/scenarios/server/tools-input-validation.ts: scenariotools-call-input-validation(introducedIn: '2025-11-25', active suite, not added to anyrequirements/*.yaml). One connection, fourtools/calls to the new fixturetest_input_validation(required integervalue, 1–10):tools-call-input-validation-valid{ "value": 5 }isError. If it fails, the other two reportnotTestable(#248)sep-1303-input-validation-rejected{ "value": "five" },{},{ "value": 11 }isErrorresult or a JSON-RPC error both passsep-1303-input-validation-tool-errorisError: truewith non-empty contentexamples/servers/typescript/everything-server.ts: thetest_input_validationfixture.examples/servers/typescript/no-input-validation.ts: a negative example. Its low-levelServerpublishes the schema but runs the handler unchecked. The vitest case innegative.test.tsasserts-rejectedis FAILURE and-tool-erroris WARNING.src/seps/sep-1303.yaml: two check rows, plus the client SHOULD (feed tool errors to the model) excluded as host-internal.Verified against the SDKs' own conformance servers
I added the same fixture to each SDK's everything-server in its idiomatic form (zod;
Annotated[int, Field(ge=1, le=10)];InputSchemawith typedAddTool) and ran this branch's CLI against it:test/conformance(McpServer)MCPServer)conformance/everything-server(stateful / stateless)Server)-rejectedFAILURE,-tool-errorWARNINGnotTestable)-rejectedSUCCESS,-tool-errorWARNING(4/4 counts
wire-schema-valid.) No Tier-1 SDK fails on behavior. Each needs the fixture tool, and I'll send those PRs once this shape is settled.npm run build,typecheck,lintandnpm test(643 tests) pass.Why
In an execution-based census of the MCP Registry (https://doi.org/10.5281/zenodo.22996025), 129 of 3,685 responding servers (3.5%) executed a tool on a wrong-typed required argument their own schema rejects, with no error indication. 112 of them are on the TypeScript SDK, mostly the low-level
Serverpath (typescript-sdk#2628).