Skip to content

v2 fix: Update spec types to latest; replace AssertObjectSchema with proper JSON type schemas#1612

Merged
KKonstantinov merged 5 commits intomodelcontextprotocol:mainfrom
KKonstantinov:fix/replace-assert-object-schema-with-json-types
Mar 5, 2026
Merged

v2 fix: Update spec types to latest; replace AssertObjectSchema with proper JSON type schemas#1612
KKonstantinov merged 5 commits intomodelcontextprotocol:mainfrom
KKonstantinov:fix/replace-assert-object-schema-with-json-types

Conversation

@KKonstantinov
Copy link
Contributor

@KKonstantinov KKonstantinov commented Mar 2, 2026

Replace the internal AssertObjectSchema (z.custom) with proper Zod schemas (JSONValueSchema, JSONObjectSchema, JSONArraySchema) that produce correct JSON types, aligning the SDK's inferred types with the spec.

Also syncs spec.types.ts and adds missing SDK types (error codes, ResultResponse types, MetaObject types) to pass spec type checks.

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Replace the internal AssertObjectSchema (z.custom<object>) with proper
Zod schemas (JSONValueSchema, JSONObjectSchema, JSONArraySchema) that
produce correct JSON types, aligning the SDK's inferred types with the
spec. This eliminates the need for most FixSpec workarounds in the type
compatibility tests.

Also syncs spec.types.ts and adds missing SDK types (error codes,
ResultResponse types, MetaObject types) to pass spec type checks.
@changeset-bot
Copy link

changeset-bot bot commented Mar 2, 2026

⚠️ No Changeset found

Latest commit: 35a05f0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@KKonstantinov KKonstantinov changed the title fix: replace AssertObjectSchema with proper JSON type schemas fix: replace AssertObjectSchema with proper JSON type schemas, align spec types Mar 2, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 2, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1612

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1612

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1612

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1612

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1612

commit: 56de257

@KKonstantinov KKonstantinov changed the title fix: replace AssertObjectSchema with proper JSON type schemas, align spec types v2 fix: replace AssertObjectSchema with proper JSON type schemas, align spec types Mar 2, 2026
@KKonstantinov KKonstantinov changed the title v2 fix: replace AssertObjectSchema with proper JSON type schemas, align spec types v2 fix: Update spec types to latest; replace AssertObjectSchema with proper JSON type schemas Mar 2, 2026
@KKonstantinov KKonstantinov marked this pull request as ready for review March 2, 2026 17:01
@KKonstantinov KKonstantinov requested a review from a team as a code owner March 2, 2026 17:01
@KKonstantinov KKonstantinov added the v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes label Mar 2, 2026
Copy link
Contributor

@felixweinberger felixweinberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for updating this straight away and for submitting the SEP in the first place! This looks nice now.

@KKonstantinov KKonstantinov merged commit 4a7cdf4 into modelcontextprotocol:main Mar 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants