Skip to content

feat!: align model types with MCP 2025-11-25 spec - #927

Merged
DaleSeo merged 2 commits into
mainfrom
feat/align-models-2025-11-25
Jun 25, 2026
Merged

feat!: align model types with MCP 2025-11-25 spec#927
DaleSeo merged 2 commits into
mainfrom
feat/align-models-2025-11-25

Conversation

@DaleSeo

@DaleSeoDaleSeo commented Jun 24, 2026

Copy link
Copy Markdown
Member

Motivation and Context

Over time the rmcp model drifted from the MCP Schema Reference. The same content union existed in three slightly different forms (Content/RawContent, PromptMessageContent, SamplingMessageContent), many types sat behind an Annotated<T> wrapper, several names didn't match the spec (ResourceReference, CreateElicitation*, GetTaskInfo*, PrimitiveSchema, and others), and some spec fields were missing (_meta in several places, audio in prompt content). Finding the type that corresponds to a given spec construct, and knowing whether it was complete and correctly named, took real effort for SDK users and maintainers alike.

We had deferred this because doing it properly is breaking, and it wasn't worth a major bump on its own. The upcoming 2026-07-28 revision changes that: it requires breaking changes regardless, so realigning the existing model to the current 2025-11-25 schema in the same major (consistent with the versioning approach in #813) avoids an extra bump and a second round of migration. It also gives the 2026-07-28 work a much cleaner baseline to build on. A full migration guide lives in discussion #926, with each type mapped to the 2025-11-25 Schema Reference.

How Has This Been Tested?

  • The test-no-local configuration: compute the feature set excluding local and run cargo test -p rmcp --features "$FEATURES" (mirrors the CI job that the default --all-features run does not cover)
  • Regenerated crates/rmcp/tests/test_message_schema/*.json snapshots and cross-checked them against schema/2025-11-25/schema.ts
  • Audited every model type field-by-field against schema/2025-11-25/schema.ts (names, required/optional, _meta, enum literals, method strings); the full cargo test -p rmcp --all-features suite passes

Breaking Changes

Yes. This is a major (2.0) change. The JSON wire format is unchanged (only additive _meta / optional fields); the breaks are at the Rust API level: the unified ContentBlock (flattened, no more Annotated<T> / Raw*), prompts using Role + ContentBlock, spec-name renames (ResourceReference to ResourceTemplateReference, CreateElicitation* to Elicit*, PrimitiveSchema to PrimitiveSchemaDefinition, GetTaskInfo* / GetTaskResult* to GetTask* / GetTaskPayload*), most wire structs becoming #[non_exhaustive], CancelledNotificationParam.request_id becoming optional, and the removal of the unused, non-spec TaskList (use ListTasksResult). _meta coverage is now complete across every Result type — CreateTaskResult and ListRootsResult were the last gaps. Old names are kept as #[deprecated] aliases where practical. TaskStatusNotificationParam now models NotificationParams & Task instead of being a Task alias; construct it with TaskStatusNotificationParam::new(task) or task.into(), and use .task where exact Task identity matters. ToolResultContent.content is now required for sampling tool results, so send content: [] when there are no content blocks; CallToolResult still keeps its existing missing-content compatibility behavior.

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

@DaleSeoDaleSeo self-assigned this Jun 24, 2026
@github-actionsgithub-actionsBot added T-test Testing related changes T-config Configuration file changes T-core Core library changes T-examples Example code changes T-handler Handler implementation changes T-macros Macro changes T-model Model/data structure changes T-service Service layer changes T-transport Transport layer changes labels Jun 24, 2026
@DaleSeo
DaleSeoforce-pushed the feat/align-models-2025-11-25 branch from 08ff6bb to e6e923bCompareJune 24, 2026 19:04
@DaleSeo
DaleSeo marked this pull request as ready for review June 24, 2026 19:11
@DaleSeo
DaleSeo requested a review from a team as a code ownerJune 24, 2026 19:11
@DaleSeoDaleSeo changed the title feat: align model types with MCP 2025-11-25 specfeat!: align model types with MCP 2025-11-25 specJun 24, 2026
@DaleSeo
DaleSeoforce-pushed the feat/align-models-2025-11-25 branch from e6e923b to b36ce69CompareJune 24, 2026 19:26
alexhancock
alexhancock previously approved these changes Jun 24, 2026
@DaleSeo

Copy link
Copy Markdown
MemberAuthor

@alexhancock I pushed one follow-up commit after your approval. I removed the unused, no-spec TaskList.

@DaleSeo
DaleSeo requested a review from alexhancockJune 24, 2026 23:33
@DaleSeo
DaleSeoforce-pushed the feat/align-models-2025-11-25 branch from 271fa02 to ae7afa5CompareJune 24, 2026 23:34
@github-actionsgithub-actionsBot added the T-documentation Documentation improvements label Jun 24, 2026
@DaleSeo
DaleSeoforce-pushed the feat/align-models-2025-11-25 branch from ae7afa5 to 9a6f182CompareJune 24, 2026 23:40
@github-actionsgithub-actionsBot removed the T-documentation Documentation improvements label Jun 24, 2026
@DaleSeo
DaleSeo merged commit 7793214 into mainJun 25, 2026
19 checks passed
@DaleSeo
DaleSeo deleted the feat/align-models-2025-11-25 branch June 25, 2026 00:41
@github-actionsgithub-actionsBot mentioned this pull request Jun 24, 2026
HikaruEgashira added a commit to plenoai/metsuke that referenced this pull request Jul 4, 2026
rmcp 2.0 renamed Content to ContentBlock as part of aligning model
types with the MCP 2025-11-25 spec (see modelcontextprotocol/rust-sdk#927).
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-configConfiguration file changesT-coreCore library changesT-examplesExample code changesT-handlerHandler implementation changesT-macrosMacro changesT-modelModel/data structure changesT-serviceService layer changesT-testTesting related changesT-transportTransport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@DaleSeo@alexhancock