schema: use JSONObject for extensions capability values#2508
Merged
felixweinberger merged 1 commit intomainfrom Apr 9, 2026
Merged
schema: use JSONObject for extensions capability values#2508felixweinberger merged 1 commit intomainfrom
felixweinberger merged 1 commit intomainfrom
Conversation
The extensions field in ClientCapabilities/ServerCapabilities used bare `object` as the value type, while the sibling experimental field (same semantic concept — open-ended vendor-prefixed config) uses JSONObject. This was the only use of bare `object` in the entire schema file. Over the wire the two validate identical JSON — both mean 'any object'. The difference is TypeScript ergonomics: JSONObject catches accidental Date/Map/function values at compile time. Normal extension config interfaces (including optional fields under exactOptionalPropertyTypes) remain assignable. Ref: SEP-2133
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
pja-ant
approved these changes
Apr 9, 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.
Change the
extensionscapability value type fromobjecttoJSONObject, matchingexperimentaland every other open-ended record in the schema.Motivation and Context
SEP-2133 added
extensionsusing bareobject:This is the only use of bare
objectin the entire schema file. Over the wire the two validate identical JSON documents (JSON parsing already guarantees JSON-serializable values), but at the TypeScript levelJSONObjectcatches accidentalDate/Map/function values at compile time.The practical impact: the typescript-sdk's nightly spec-sync workflow has a type-parity test that asserts bidirectional assignability between spec types and Zod-inferred types. The SDK's Zod schemas for
extensions(correctly) useJSONObjectsemantics, so the parity test fails whenspec.types.tsreverts toobject. See modelcontextprotocol/typescript-sdk#1782 for context.How Has This Been Tested?
npm run check:schema:tspassesnpm run check:schema:jsonpassesnpm run check:schema:examplespasses (134/134, including both extensions examples)JSONObjectunder both--strictand--strict --exactOptionalPropertyTypesBreaking Changes
None on the wire. TypeScript consumers who were passing non-JSON-serializable values (class instances, Dates, functions) as extension configs will get a compile error, which is the intended effect.
Types of changes
Checklist
Additional context
No type discussion in the SEP-2133 review — the
objectchoice appears to have been unintentional.schema.jsonandschema.mdxregenerated.