chore: sync schemas to spec @142b3c3c; segregate pre-2026 wire schemas#2129
Draft
felixweinberger wants to merge 2 commits into
Draft
chore: sync schemas to spec @142b3c3c; segregate pre-2026 wire schemas#2129felixweinberger wants to merge 2 commits into
felixweinberger wants to merge 2 commits into
Conversation
pnpm fetch:spec-types. Spec moved 44 commits since last regen. Brings: - RequestMetaObject with namespaced io.modelcontextprotocol/* keys (required protocolVersion/clientInfo/clientCapabilities) - Result.resultType: "complete" | "input_required" (required) - DiscoverRequest/Result, InputRequiredResult, InputRequest/Response/s, InputResponseRequestParams - SubscriptionsListenRequest, SubscriptionFilter, SubscriptionsAcknowledgedNotification - UnsupportedProtocolVersionError, MissingRequiredClientCapabilityError (-32003) Removes (moved to extension or removed from spec): - InitializeRequest/Result, InitializedNotification, PingRequest, SetLevelRequest - SubscribeRequest, UnsubscribeRequest, RootsListChangedNotification - All Task* types, taskSupport, TaskAugmentedRequestParams Typecheck broken pending next commit (schemas.ts/guards.ts reference removed types). Isolated for diff clarity per plan §10.
…emas
schemas.ts:
- Result/Notification _meta now use plain MetaObject (not RequestMetaSchema)
- ResultTypeSchema, resultType optional on ResultSchema (BC: pre-2026 omits it)
- RequestMetaSchema kept simple {progressToken?}; namespaced io.modelcontextprotocol/*
keys validated by parseClientMeta in P2, not here (TS2589 depth budget)
- DiscoverRequest/Result, UnsupportedProtocolVersionErrorData,
MissingRequiredClientCapabilityErrorData
- SubscriptionFilter, SubscriptionsListenRequest/Params,
SubscriptionsAcknowledgedNotification/Params
- InputRequest/Response/s, InputRequiredResult, InputResponseRequestParams
- CacheableResult/CacheScope (SEP-2243), PaginatedResult extends CacheableResult,
ReadResourceResult extends CacheableResult
- structuredContent: unknown (was Record<string,unknown>)
- Tool inputSchema/outputSchema loosened to match spec (open record + type:object on input)
- ToolExecution removed (only had taskSupport)
- ClientRequest/ServerNotification/etc unions = 2026 spec methods only
- registerLegacySchemas() lets legacyWireSchemas merge into runtime lookup maps
- Dropped Initialize*/Ping/SetLevel/Subscribe/Unsubscribe/RootsListChanged
NEW legacyWireSchemas.ts:
- LegacyRequestParams/Result/RequestMetaObject base types (no namespaced keys, no resultType)
- TS interfaces + zod for Initialize/Ping/SetLevel/Subscribe/Unsubscribe/RootsListChanged
- legacyRequest/Result/NotificationSchemas maps; registerLegacySchemas() side-effect on import
types.ts: re-exports legacy types; RequestTypeMap/NotificationTypeMap/ResultTypeMap
merge legacy methods. Adds Discover*/InputRequired*/Subscriptions*/Cache* types.
guards.ts: isInitializeRequest/isInitializedNotification import from legacyWireSchemas.
specTypeSchema.ts: allowlist updated (drop legacy, add 2026).
spec.types.test.ts: Relax<T> helper makes spec-required PermissiveKeys
(_meta/resultType/ttlMs/cacheScope/inputResponses/requestState/io.modelcontextprotocol/*)
optional so mutual assignability holds for everything else. Dropped checks for
removed types; added 17 checks for 2026 types. Count 176→150.
types.capabilities.test.ts: import InitializeRequestParamsSchema from legacyWireSchemas.
types.test.ts: outputSchema no longer requires type:object.
mcp.ts: drop ToolExecution/execution (removed from spec).
client.ts: assertCapabilityForMethod switches on RequestMethod (includes legacy).
|
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regenerates
spec.types.tsfrom spec draft@142b3c3cand hand-syncsschemas.tsto match. Pre-2026 wire schemas (Initialize/Ping/SetLevel/Subscribe/Unsubscribe) move tolegacyWireSchemas.tssince the regenerated spec no longer includes them.Motivation and Context
Prerequisite for SEP-2575/2322 — the SDK needs
DiscoverRequest,InputRequiredResult,SubscriptionFilter, namespaced_metatypes.How Has This Been Tested?
pnpm test:all(1241). C2 (regen) intentionally fails typecheck in isolation; C3 restores it.Breaking Changes
Public types updated to match spec; see
docs/migration.md.Types of changes
Checklist