Skip to content

feat(server): add tools-call-input-validation scenario (SEP-1303) - #589

Open
Ahmad-Faraj wants to merge 2 commits into
modelcontextprotocol:mainfrom
Ahmad-Faraj:feat/sep-1303-input-validation
Open

Ahmad-Faraj wants to merge 2 commits into
modelcontextprotocol:mainfrom
Ahmad-Faraj:feat/sep-1303-input-validation

Conversation

@Ahmad-Faraj

@Ahmad-Faraj Ahmad-Faraj commented Nov 16, 2026 •

Copy link
Copy Markdown

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: scenario tools-call-input-validation (introducedIn: '2025-11-25', active suite, not added to any requirements/*.yaml). One connection, four tools/calls to the new fixture test_input_validation (required integer value, 1–10):
Check id Probe Passes when Severity
tools-call-input-validation-valid { "value": 5 } text result, no isError. If it fails, the other two report notTestable (#248) FAILURE
sep-1303-input-validation-rejected { "value": "five" }, {}, { "value": 11 } none executes; an isError result or a JSON-RPC error both pass FAILURE (MUST)
sep-1303-input-validation-tool-error same three each rejection is isError: true with non-empty content WARNING (keyword-less taxonomy; see #588 Q1)
  • examples/servers/typescript/everything-server.ts: the test_input_validation fixture.
  • examples/servers/typescript/no-input-validation.ts: a negative example. Its low-level Server publishes the schema but runs the handler unchecked. The vitest case in negative.test.ts asserts -rejected is FAILURE and -tool-error is 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)]; InputSchema with typed AddTool) and ran this branch's CLI against it:

Server 2025-11-25 2026-07-28
typescript-sdk main, test/conformance (McpServer) 4/4 4/4
python-sdk main, everything-server (MCPServer) 4/4 4/4
go-sdk main, conformance/everything-server (stateful / stateless) 4/4 4/4
this repo's everything-server 4/4 4/4
negative example (low-level Server) -rejected FAILURE, -tool-error WARNING — (SDK 1.x does not speak the draft wire, so notTestable)
a server rejecting with JSON-RPC -32602 -rejected SUCCESS, -tool-error WARNING

(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, lint and npm 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 Server path (typescript-sdk#2628).

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>
Copilot AI balanced review requested due to automatic review settings November 16, 2026 07:27

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T07:30:20.749664Z 9488899 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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

No deployments
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.

Proposal: tools-call-input-validation server scenario (SEP-1303, "Servers MUST validate all tool inputs")

2 participants