Skip to content

fix(server): validate wrapped output schemas on v1#2001

Open
Genmin wants to merge 1 commit intomodelcontextprotocol:v1.xfrom
Genmin:codex/fix-v1-output-schema-validation
Open

fix(server): validate wrapped output schemas on v1#2001
Genmin wants to merge 1 commit intomodelcontextprotocol:v1.xfrom
Genmin:codex/fix-v1-output-schema-validation

Conversation

@Genmin
Copy link
Copy Markdown

@Genmin Genmin commented May 1, 2026

Summary

  • mirror input validation's fallback behavior for tool output schemas on v1.x
  • validate wrapped/non-object top-level Zod output schemas directly when normalizeObjectSchema() cannot produce an object schema
  • add regression coverage across the Zod v3/v4 matrix for optional, nullable, nullish, and union output schemas

Fixes #1308 for the v1.x release line.

Validation

  • npm test -- test/server/mcp.test.ts -t "non-object-wrapper"
  • npm test -- test/server/mcp.test.ts
  • npx prettier --check src/server/mcp.ts test/server/mcp.test.ts .changeset/fix-output-schema-wrappers.md
  • npx eslint src/server/mcp.ts
  • git diff --check

Note: npm run typecheck -- --pretty false currently fails on unrelated existing v1.x test errors in test/integration-tests/taskLifecycle.test.ts and test/shared/protocol.test.ts (Expected 2-3 arguments, but got 1). No typecheck error points at the files changed in this PR.

@Genmin Genmin requested a review from a team as a code owner May 1, 2026 01:01
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 1, 2026

🦋 Changeset detected

Latest commit: 427660b

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

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
Copy link
Copy Markdown

pkg-pr-new Bot commented May 1, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@modelcontextprotocol/sdk@2001

commit: 427660b

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