Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

Upgrade Schema Reference page#2038

Merged
jonathanhefner merged 31 commits intomainmodelcontextprotocol/modelcontextprotocol:mainfrom
jonathanhefner/schema-ref-evolutionmodelcontextprotocol/modelcontextprotocol:jonathanhefner/schema-ref-evolutionCopy head branch name to clipboard
Jan 4, 2026
Merged

Upgrade Schema Reference page#2038
jonathanhefner merged 31 commits intomainmodelcontextprotocol/modelcontextprotocol:mainfrom
jonathanhefner/schema-ref-evolutionmodelcontextprotocol/modelcontextprotocol:jonathanhefner/schema-ref-evolutionCopy head branch name to clipboard

Conversation

@jonathanhefner
Copy link
Member

I have been sprinting on improving the Schema Reference page. This PR contains many commits toward that goal. Each commit is a self-contained change. I can split this into multiple PRs, if desired, but I wanted to first submit a PR that shows how everything fits together.

Key changes:

  • Support examples on the Schema Reference page (via the @example tag). Examples are collapsed by default to avoid overwhelming the page. Examples are also linkable, and when navigating to an example via link, the example will be automatically expanded.
  • Validate example JSON files as part of CI — if an example is stored as a file in schema/[version]/examples/[type]/[example].json, it will be validated against the JSON schema for [type] via npm run check (specifically, npm run check:schema:examples). Such examples can be included in doc comments via the @includeCode tag.
  • Copy examples from existing specification documentation to schema/[version]/examples/[type]/[example].json.
  • Add *ResultResponse types for corresponding *Request and *Result types. (Previously, *Request and *Result types existed, but there were no types for successful JSON-RPC responses.) Each *ResultResponse type has a JSON example, and links to its corresponding *Request type.
  • Add explicit ParseError, InvalidRequestError, MethodNotFoundError, InvalidParamsError, and InternalError types for error codes -32700, -32600, -32601, -32602, and -32603, respectively. These error types have doc comments explaining the scenarios in which they should be used.
  • Add MetaObject and RequestMetaObject types for _meta fields. These types consolidate the documentation for the _meta and _meta.progressToken fields so that they exist in a single place on the Schema Reference page, and clean up the type signatures of the other types that use them.
  • Link references and add backticks around inline code in doc comments.
  • Fix order of members in types to reflect the source code (for more logical ordering).

All changes were made with the assistance of Claude Code, but I closely guided each change and reviewed every line.

The preview is available at https://mcp-jonathanhefner-schema-ref-evolution.mintlify.app/specification/draft/schema, but here are some select screenshots:

Before After
before 01-top after 01-top
before 02-InitializeRequestParams-requestmetaobject-collapsed-example after 02-InitializeRequestParams
before 03a-ServerCapabilities-collapsed-member-examples after 03a-ServerCapabilities
after 03b-ServerCapabilities-expanded-member-examples
before 04a-CallToolResult-collapsed-examples after 04a-CallToolResult
after 04b-CallToolResultResponse-expanded-example
1 2
Error types: after 05-InvalidParamsError after 06-MethodNotFoundError
_meta types: after 07-MetaObject after 08-RequestMetaObject

jonathanhefner and others added 30 commits December 30, 2025 16:46
This preserves the field order as written in the TypeScript source files
instead of alphabetizing them, making the schema reference page
consistent with `schema.ts`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds `{@link}` syntax to type references in order to make them navigable
in generated documentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Format TSDoc comments to use inline code styling for:

- Method/endpoint names like `tasks/result`, `resources/list`
- Parameter names like `includeContext`, `toolChoice`
- String literal values like `"forbidden"`, `"optional"`
- Type self-references like `ToolAnnotations`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change `RequestParams`, `PaginatedRequestParams`, and
`NotificationParams` from `@internal` to `@category Common Types` so
they appear in the generated schema reference. Previously these types
were referenced by other types but couldn't be clicked or inspected,
creating documentation holes.

Also standardizes terminology for Common Types:

- "parameters" → "params" for consistency
- "response" → "result" in `EmptyResult` description
- Adds missing description for `Result` type

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace backtick code references like `resources/list` with JSDoc
`{@link TypeName | endpoint/path}` syntax throughout the schema
documentation. This enables proper cross-referencing in generated
documentation while preserving the familiar endpoint paths as display
text.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Enable `jsDocCompatibility.exampleTag: false` in TypeDoc config to
  render examples as fenced code blocks
- Update plugin to render block tags (e.g., `@example`) after summaries
  but before members for interfaces/classes
- Add syntax highlighting CSS for example JSON
- Rework vertical margins CSS for schema page

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Anchor links will appear as `#` symbols that change color on hover.

assets/icons.svg#icon-anchor

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Introduces a new script that validates example JSON files in
`schema/<version>/examples/` directories against their corresponding
type definitions. Handles both legacy schema versions (using standard
Ajv) and newer versions (using Ajv2020).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add section explaining how JSON examples are organized in
`schema/[version]/examples/[TypeName]/` directories, where the directory
name determines the schema type for validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove duplicate `id="see"` attributes to ensure valid HTML
- Hide defunct anchor links for "See" blocks
- Add trailing colon after "See" heading
- Style singular "See" links to display inline with their heading

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change example sections from `<div>` to `<details>` elements so they can
be expanded/collapsed, reducing visual clutter. The elements will be
collapsed by default, but will automatically expand when navigated to
via an `id` in the URL fragment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Prefix `id` attributes of example elements with the parent reflection's
anchor (e.g., `id="tool-example-name"` instead of `id="example-name"`)
in order to prevent collisions when multiple types have examples with
the same name.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace individual `replaceAll` calls with a centralized approach using
a character list, regex, and HTML entity lookup table. This makes the
escaping logic more maintainable and adds support for additional special
characters such as `*` and backticks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Define `InternalError`, `InvalidParamsError`, `InvalidRequestError`,
`MethodNotFoundError`, and `ParseError` interfaces that extend `Error`
with their standard JSON-RPC error codes. Each type includes
documentation on when it should be used in MCP implementations.

Move `Error` from "Common Types" to a new "Errors" section that groups
all error types together.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add JSON examples for `Tool`, `CallToolRequestParams`, `CallToolResult`,
`ListToolsResult`, and `ToolListChangedNotification` schema types, as
well as content block schema types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add JSON examples for resource-related types such as `Resource`,
`ListResourcesResult`, `ReadResourceResult`, etc.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds JSON examples for prompt-related schema types such as
`ListPromptsResult`, `GetPromptRequestParams`, `GetPromptResult`, etc.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add JSON examples for completion-related types such as
`CompleteRequestParams` and `CompleteResult`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds JSON examples for logging-related types such as
`SetLevelRequestParams` and `LoggingMessageNotificationParams`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a new example showing how to use the `cursor` parameter for
paginated requests. Also updates the existing `ListResourcesResult`
example to use base64-encoded cursor values for consistency across
pagination examples.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add JSON examples for sampling-related types such as
`CreateMessageRequestParams`, `CreateMessageResult`, and
`SamplingMessage`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add JSON examples for roots-related types such as `ListRootsResult` and
`RootsListChangedNotification`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add JSON examples for elicitation-related types such as
`ElicitRequestFormParams`, `ElicitResult`, and elicitation input
schemas.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add examples for initialization-related types such as
`InitializeRequestParams` and `InitializeResult`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a new example for a progress notification with a `message` field.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a new example for a cancelled notification with a `reason` field
indicating user-requested cancellation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Introduces two named types to replace inline `_meta` type definitions:

- `MetaObject`: A `Record<string, unknown>` type alias for `_meta` in
  notifications, results, and content types
- `RequestMetaObject`: An interface with optional `progressToken` for
  `_meta` in request params

This cleans up the generated schema documentation by replacing verbose
inline type definitions with references to these named types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, type signature elements for members (`.tsd-signature`) were
hidden via CSS. Now, the TypeDoc plugin copies their text content into
each member's heading element (`.tsd-anchor-link`).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds new interfaces that extend `JSONRPCResultResponse` and wrap
`*Result` types, providing full JSON-RPC response objects for
documentation purposes. Also updates documentation to distinguish
between `*Result` (payload only) and `*ResultResponse` (full response)
types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add JSON examples for `*Request`, `*Notification`, and `*ResultResponse`
types. These complement the existing examples for payload types
(`*Params`, `*Result`) by showing complete JSON-RPC message envelopes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a new example showing how to include a `progressToken` in `_meta`
when calling a tool. This demonstrates the connection between the token
passed in tool call requests and the progress notifications that
reference it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

@bhosmer-ant bhosmer-ant left a comment

Choose a reason for hiding this comment

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

Beautiful piece of work!

@jonathanhefner jonathanhefner merged commit 8b1ea3d into main Jan 4, 2026
7 checks passed
@jonathanhefner jonathanhefner deleted the jonathanhefner/schema-ref-evolution branch January 4, 2026 18:58
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.