Migrating to 1.x #716
alexhancock
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Upgrading to RMCP 1.x — Migration Guide
TL;DR
Foo { field_a, field_b, .. }Foo::new(required_fields).with_optional(val)#[non_exhaustive]on structs..Default::default()::new()+.with_*()builders#[non_exhaustive]on enums/errorsmatch_ => {}catch-all armTool::with_executionsignaturewith_execution(self, ToolExecution)with_execution(self, Option<ToolExecution>)1.
ServerInfo/InitializeResultBefore:
After:
Other builders:
.with_server_info(impl),.with_protocol_version(ver).2.
CallToolRequestParamsBefore:
After:
3.
GetPromptRequestParamsBefore:
After:
4.
GetPromptResultBefore:
After:
5.
InitializeRequestParams/ClientInfoBefore:
After:
6.
ImplementationBefore:
After:
7.
CreateMessageResultBefore:
After:
8.
CreateMessageRequestParamsBefore:
After:
9.
Tool(manual construction)Before:
After:
Optional chaining:
.with_title(t),.with_annotations(a),.with_execution(e),.with_icons(i),.with_meta(m),.with_raw_output_schema(s).10.
ToolAnnotationsBefore:
After:
Or use the existing builder:
ToolAnnotations::new().with_title("My Tool")...11.
TaskBefore:
After:
12. Other Structs with New Constructors
ReadResourceRequestParams::new(uri)ReadResourceResult::new(contents)SubscribeRequestParams::new(uri)SetLevelRequestParams::new(level)ProgressNotificationParam::new(token, progress)CompleteRequestParams::new(ref, argument).with_context(ctx)CompleteResult::new(completion)Icon::new(src).with_mime_type(m).with_sizes(s)Prompt::new(name, desc).with_title(t)or::from_raw(...)PromptArgument::new(name).with_description(d).with_required(b)PromptMessage::new(role, content)ModelPreferences::new().with_hints(h).with_cost_priority(f)ModelHint::new(name)CreateElicitationResult::new(action)or::with_content(action, val)ListTasksResult::new(tasks)CreateTaskResult::new(task)GetTaskPayloadResult::new(value)JsonRpcRequest::new(id, request)JsonRpcError::new(id, error)RequestContext::new(id, peer)RawEmbeddedResource::new(resource)ConstTitle::new(const_, title)TitledSingleSelectEnumSchema::new(one_of)TitledMultiSelectEnumSchema::new(items).with_min_items(n)...TitledItems::new(any_of)ResourceUpdatedNotificationParam::new(uri)LoggingMessageNotificationParam::new(level, data)or::with_logger(level, logger, data)ElicitationResponseNotificationParam::new(elicitation_id)13.
#[non_exhaustive]Enums & ErrorsSeveral error enums and a few other enums are now
#[non_exhaustive]:RmcpErrorClientInitializeErrorServerInitializeErrorElicitationErrorAuthErrorStreamableHttpErrorStreamableHttpProtocolErrorStreamableHttpPostResponseWorkerQuitReasonSessionQuitReasonLocalSessionWorkerErrorQuitReasonElicitationAction(add_ => {}in match arms)Fix: Add a wildcard arm to any
matchon these types:14. Notification Construction
Notifications now have a
::new(params)constructor instead of struct literals:Before:
After:
Same pattern applies to
CreateElicitationRequest::new(params).15.
ClientCapabilitiesBuilderElicitation capabilities now go through the builder:
Before:
After:
Quick Migration Checklist
::new()+.with_*()..Default::default()on affected types → replace with buildermatchon any newly#[non_exhaustive]enum → add_ => {}armTool::with_executioncall sites → wrap argument inSome(...)cargo buildand follow remaining compiler errors — the compiler is your friend hereGenerated 2026-03-02. Based on rust-sdk PR #715.
Beta Was this translation helpful? Give feedback.
All reactions