Skip to content

fix: align zod object schemas with stripped properties#1985

Open
Genmin wants to merge 2 commits intomodelcontextprotocol:mainfrom
Genmin:fix/zod-object-additional-properties-schema
Open

fix: align zod object schemas with stripped properties#1985
Genmin wants to merge 2 commits intomodelcontextprotocol:mainfrom
Genmin:fix/zod-object-additional-properties-schema

Conversation

@Genmin
Copy link
Copy Markdown

@Genmin Genmin commented Apr 29, 2026

Summary

  • mark converted default Zod object schemas with additionalProperties: false when Zod validation will strip unknown keys
  • preserve explicit passthrough schemas and avoid adding a root additionalProperties to union schemas
  • assert the advertised tool schema now matches runtime behavior for registered tools

Fixes #147.

Validation

  • pnpm --filter @modelcontextprotocol/core test -- packages/core/test/util/standardSchema.test.ts
  • pnpm --filter @modelcontextprotocol/server test -- test/integration/test/server/mcp.test.ts -t "should register tool with params"
  • pnpm --filter @modelcontextprotocol/core typecheck
  • pnpm --filter @modelcontextprotocol/core lint
  • pnpm --filter @modelcontextprotocol/test-integration lint
  • pre-push: full typecheck:all, build:all, and lint:all

@Genmin Genmin requested a review from a team as a code owner April 29, 2026 23:49
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 29, 2026

🦋 Changeset detected

Latest commit: 705f264

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

This PR includes changesets to release 2 packages
Name Type
@modelcontextprotocol/core Patch
@modelcontextprotocol/test-integration Patch

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 Apr 29, 2026

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/fastify

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: 705f264

@Genmin
Copy link
Copy Markdown
Author

Genmin commented Apr 30, 2026

Added the missing patch changeset for the touched core and integration packages so the release-metadata blocker should clear on the next checks run. This is metadata-only; the previous code checks were green.

@Genmin Genmin force-pushed the fix/zod-object-additional-properties-schema branch from e4f02eb to 705f264 Compare April 30, 2026 16:20
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.

Additional parameters are not passed through to tools

1 participant