Skip to content

fix: complete SEP-2106 output typing and schema safety#2449

Open
mattzcarey wants to merge 1 commit into
mainfrom
fix/sep-2106-output-schema-safety
Open

fix: complete SEP-2106 output typing and schema safety#2449
mattzcarey wants to merge 1 commit into
mainfrom
fix/sep-2106-output-schema-safety

Conversation

@mattzcarey

Copy link
Copy Markdown
Contributor

Previously unaddressed

#2337 implemented SEP-2106's runtime and wire behavior, but explicitly left outputSchema disconnected from the tool handler's return type and did not add the SEP's schema-complexity guards.

This PR

  • infers successful structuredContent from outputSchema, while preserving error results, input-required results, and schema-less tools
  • bounds depth and subschema count in built-in validators and rejects non-local references before compilation
  • leaves custom validators and custom Ajv instances in control of their own safety policy

Runtime validation remains authoritative; intentional negative fixtures use an explicit unsafe cast.

Verification

  • core-internal: 1,341 tests
  • server: 439 tests
  • affected e2e scenarios: 490 passed, 26 expected-fail
  • pnpm check:all
  • pnpm build:all

Follow-up to #2249, #2337, and #2286.

@mattzcarey mattzcarey requested a review from a team as a code owner July 7, 2026 11:11
@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ea5c666

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/client Patch
@modelcontextprotocol/server Minor
@modelcontextprotocol/express Major
@modelcontextprotocol/fastify Major
@modelcontextprotocol/hono Major
@modelcontextprotocol/node Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2449

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@2449

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@2449

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2449

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@2449

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2449

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2449

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2449

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2449

commit: ea5c666

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.

1 participant