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

@DaleSeo DaleSeo 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

@DaleSeo DaleSeo self-assigned this Jun 24, 2026
@github-actions github-actions Bot 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 DaleSeo force-pushed the feat/align-models-2025-11-25 branch from 08ff6bb to e6e923b Compare June 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 owner June 24, 2026 19:11
@DaleSeo DaleSeo changed the title feat: align model types with MCP 2025-11-25 spec feat!: align model types with MCP 2025-11-25 spec Jun 24, 2026
@DaleSeo DaleSeo force-pushed the feat/align-models-2025-11-25 branch from e6e923b to b36ce69 Compare June 24, 2026 19:26
alexhancock
alexhancock previously approved these changes Jun 24, 2026
@DaleSeo

DaleSeo commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

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

@DaleSeo DaleSeo requested a review from alexhancock June 24, 2026 23:33
@DaleSeo DaleSeo force-pushed the feat/align-models-2025-11-25 branch from 271fa02 to ae7afa5 Compare June 24, 2026 23:34
@github-actions github-actions Bot added the T-documentation Documentation improvements label Jun 24, 2026
@DaleSeo DaleSeo force-pushed the feat/align-models-2025-11-25 branch from ae7afa5 to 9a6f182 Compare June 24, 2026 23:40
@github-actions github-actions Bot removed the T-documentation Documentation improvements label Jun 24, 2026
@DaleSeo DaleSeo merged commit 7793214 into main Jun 25, 2026
19 checks passed
@DaleSeo DaleSeo deleted the feat/align-models-2025-11-25 branch June 25, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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-test Testing related changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants