Skip to content

Commit 1c474b2

Browse files
committed
Update rmcp
1 parent 8b62077 commit 1c474b2

10 files changed

Lines changed: 62 additions & 82 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ tracing-appender = "0.2"
3939
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
4040

4141
# MCP SDK
42-
rmcp = { version = "0.12.0", features = ["server", "transport-io", "schemars"] }
42+
rmcp = { version = "1.0.0-alpha", features = ["server", "transport-io", "schemars"] }
4343

4444
# CLI parsing
4545
clap = { version = "4.5", features = ["derive"] }

src/elizacp/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl ElizaAgent {
294294
tool_name: &str,
295295
params_json: &str,
296296
) -> Result<String> {
297-
use rmcp::model::CallToolRequestParam;
297+
use rmcp::model::CallToolRequestParams;
298298

299299
// Parse params JSON
300300
let params = serde_json::from_str::<serde_json::Value>(params_json)
@@ -308,10 +308,10 @@ impl ElizaAgent {
308308

309309
// Call the tool
310310
let tool_result = mcp_client
311-
.call_tool(CallToolRequestParam {
312-
name: tool_name.into(),
313-
arguments: params_obj,
314-
})
311+
.call_tool(
312+
CallToolRequestParams::new(tool_name)
313+
.with_arguments(params_obj.unwrap_or_default()),
314+
)
315315
.await?;
316316

317317
tracing::debug!("Tool call result: {:?}", tool_result);

src/sacp-conductor/tests/mcp-integration.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,13 @@ async fn test_agent_handles_prompt() -> Result<(), sacp::Error> {
225225
tracing::debug!(session_id = %session.session_id.0, "Session created");
226226

227227
// Send a prompt to call the echo tool via ElizACP's command syntax
228-
let prompt_response = recv(
229-
connection_to_editor.send_request(PromptRequest::new(
230-
session.session_id.clone(),
231-
vec![ContentBlock::Text(TextContent::new(
228+
let prompt_response = recv(connection_to_editor.send_request(PromptRequest::new(
229+
session.session_id.clone(),
230+
vec![ContentBlock::Text(TextContent::new(
232231
r#"Use tool test::echo with {"message": "Hello from the test!"}"#
233232
.to_string(),
234233
))],
235-
)),
236-
)
234+
)))
237235
.await?;
238236

239237
// Log the response

src/sacp-conductor/tests/standalone_mcp_server.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,14 @@ async fn test_standalone_server_call_echo_tool() -> Result<(), sacp::Error> {
126126

127127
// Call the echo tool
128128
let result = client
129-
.call_tool(rmcp::model::CallToolRequestParam {
130-
name: "echo".into(),
131-
arguments: Some(
129+
.call_tool(
130+
rmcp::model::CallToolRequestParams::new("echo").with_arguments(
132131
serde_json::json!({ "message": "hello world" })
133132
.as_object()
134133
.unwrap()
135134
.clone(),
136135
),
137-
})
136+
)
138137
.await
139138
.map_err(sacp::util::internal_error)?;
140139

@@ -174,15 +173,14 @@ async fn test_standalone_server_call_add_tool() -> Result<(), sacp::Error> {
174173

175174
// Call the add tool
176175
let result = client
177-
.call_tool(rmcp::model::CallToolRequestParam {
178-
name: "add".into(),
179-
arguments: Some(
176+
.call_tool(
177+
rmcp::model::CallToolRequestParams::new("add").with_arguments(
180178
serde_json::json!({ "a": 5, "b": 3 })
181179
.as_object()
182180
.unwrap()
183181
.clone(),
184182
),
185-
})
183+
)
186184
.await
187185
.map_err(sacp::util::internal_error)?;
188186

@@ -225,10 +223,7 @@ async fn test_standalone_server_tool_not_found() -> Result<(), sacp::Error> {
225223

226224
// Call a non-existent tool
227225
let result = client
228-
.call_tool(rmcp::model::CallToolRequestParam {
229-
name: "nonexistent".into(),
230-
arguments: None,
231-
})
226+
.call_tool(rmcp::model::CallToolRequestParams::new("nonexistent"))
232227
.await;
233228

234229
// Should get an error
@@ -288,15 +283,14 @@ async fn test_standalone_server_with_disabled_tools() -> Result<(), sacp::Error>
288283

289284
// Calling disabled tool should fail
290285
let result = client
291-
.call_tool(rmcp::model::CallToolRequestParam {
292-
name: "echo".into(),
293-
arguments: Some(
286+
.call_tool(
287+
rmcp::model::CallToolRequestParams::new("echo").with_arguments(
294288
serde_json::json!({ "message": "test" })
295289
.as_object()
296290
.unwrap()
297291
.clone(),
298292
),
299-
})
293+
)
300294
.await;
301295

302296
assert!(result.is_err(), "Expected error for disabled tool");

src/sacp-conductor/tests/trace_client_mcp_server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,9 @@ async fn test_trace_client_mcp_server() -> Result<(), sacp::Error> {
439439
"capabilities": Object {},
440440
"clientInfo": Object {
441441
"name": String("rmcp"),
442-
"version": String("0.12.0"),
442+
"version": String("1.0.0-alpha"),
443443
},
444-
"protocolVersion": String("2025-03-26"),
444+
"protocolVersion": String("2025-06-18"),
445445
},
446446
},
447447
),
@@ -457,10 +457,10 @@ async fn test_trace_client_mcp_server() -> Result<(), sacp::Error> {
457457
"tools": Object {},
458458
},
459459
"instructions": String("A test MCP server hosted by the client"),
460-
"protocolVersion": String("2025-03-26"),
460+
"protocolVersion": String("2025-06-18"),
461461
"serverInfo": Object {
462462
"name": String("rmcp"),
463-
"version": String("0.12.0"),
463+
"version": String("1.0.0-alpha"),
464464
},
465465
},
466466
},

src/sacp-conductor/tests/trace_mcp_tool_call.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,9 @@ async fn test_trace_mcp_tool_call() -> Result<(), sacp::Error> {
425425
"capabilities": Object {},
426426
"clientInfo": Object {
427427
"name": String("rmcp"),
428-
"version": String("0.12.0"),
428+
"version": String("1.0.0-alpha"),
429429
},
430-
"protocolVersion": String("2025-03-26"),
430+
"protocolVersion": String("2025-06-18"),
431431
},
432432
},
433433
),
@@ -443,10 +443,10 @@ async fn test_trace_mcp_tool_call() -> Result<(), sacp::Error> {
443443
"tools": Object {},
444444
},
445445
"instructions": String("A simple test MCP server with an echo tool"),
446-
"protocolVersion": String("2025-03-26"),
446+
"protocolVersion": String("2025-06-18"),
447447
"serverInfo": Object {
448448
"name": String("rmcp"),
449-
"version": String("0.12.0"),
449+
"version": String("1.0.0-alpha"),
450450
},
451451
},
452452
},

src/sacp-cookbook/src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,9 @@ pub mod global_mcp_server {
533533
//! #[tool_handler]
534534
//! impl ServerHandler for MyMcpServer {
535535
//! fn get_info(&self) -> ServerInfo {
536-
//! ServerInfo {
537-
//! protocol_version: ProtocolVersion::V_2024_11_05,
538-
//! capabilities: ServerCapabilities::builder().enable_tools().build(),
539-
//! server_info: Implementation::from_build_env(),
540-
//! instructions: None,
541-
//! }
536+
//! ServerInfo::new(ServerCapabilities::builder().enable_tools().build())
537+
//! .with_protocol_version(ProtocolVersion::V_2024_11_05)
538+
//! .with_server_info(Implementation::from_build_env())
542539
//! }
543540
//! }
544541
//!

src/sacp-rmcp/examples/with_mcp_server.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,10 @@ impl ExampleMcpServer {
5858
#[tool_handler]
5959
impl ServerHandler for ExampleMcpServer {
6060
fn get_info(&self) -> ServerInfo {
61-
ServerInfo {
62-
protocol_version: ProtocolVersion::V_2024_11_05,
63-
capabilities: ServerCapabilities::builder().enable_tools().build(),
64-
server_info: Implementation {
65-
name: "example-mcp-server".to_string(),
66-
version: "0.1.0".to_string(),
67-
icons: None,
68-
title: None,
69-
website_url: None,
70-
},
71-
instructions: Some("A simple example MCP server with an echo tool".to_string()),
72-
}
61+
ServerInfo::new(ServerCapabilities::builder().enable_tools().build())
62+
.with_server_info(Implementation::new("example-mcp-server", "0.1.0"))
63+
.with_protocol_version(ProtocolVersion::V_2024_11_05)
64+
.with_instructions("A simple example MCP server with an echo tool")
7365
}
7466
}
7567

src/sacp-test/src/bin/mcp_echo_server.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,10 @@ impl EchoServer {
5050
#[tool_handler]
5151
impl ServerHandler for EchoServer {
5252
fn get_info(&self) -> ServerInfo {
53-
ServerInfo {
54-
protocol_version: ProtocolVersion::V_2024_11_05,
55-
capabilities: ServerCapabilities::builder().enable_tools().build(),
56-
server_info: Implementation {
57-
name: "mcp-echo-server".to_string(),
58-
version: "1.0.0".to_string(),
59-
icons: None,
60-
title: None,
61-
website_url: None,
62-
},
63-
instructions: Some("A simple MCP server with an echo tool for testing".to_string()),
64-
}
53+
ServerInfo::new(ServerCapabilities::builder().enable_tools().build())
54+
.with_server_info(Implementation::new("mcp-echo-server", "1.0.0"))
55+
.with_protocol_version(ProtocolVersion::V_2024_11_05)
56+
.with_instructions("A simple MCP server with an echo tool for testing")
6557
}
6658
}
6759

src/sacp/src/mcp_server/builder.rs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ impl<Counterpart: Role> ConnectTo<role::mcp::Client> for McpServerConnection<Cou
411411
impl<R: Role> ServerHandler for McpServerConnection<R> {
412412
async fn call_tool(
413413
&self,
414-
request: rmcp::model::CallToolRequestParam,
414+
request: rmcp::model::CallToolRequestParams,
415415
context: rmcp::service::RequestContext<rmcp::RoleServer>,
416416
) -> Result<CallToolResult, ErrorData> {
417417
// Lookup the tool definition, erroring if not found or disabled
@@ -467,7 +467,7 @@ impl<R: Role> ServerHandler for McpServerConnection<R> {
467467

468468
async fn list_tools(
469469
&self,
470-
_request: Option<rmcp::model::PaginatedRequestParam>,
470+
_request: Option<rmcp::model::PaginatedRequestParams>,
471471
_context: rmcp::service::RequestContext<rmcp::RoleServer>,
472472
) -> Result<rmcp::model::ListToolsResult, ErrorData> {
473473
// Return only enabled tools
@@ -483,13 +483,18 @@ impl<R: Role> ServerHandler for McpServerConnection<R> {
483483

484484
fn get_info(&self) -> rmcp::model::ServerInfo {
485485
// Basic server info
486-
rmcp::model::ServerInfo {
487-
protocol_version: rmcp::model::ProtocolVersion::default(),
488-
capabilities: rmcp::model::ServerCapabilities::builder()
486+
let base = rmcp::model::ServerInfo::new(
487+
rmcp::model::ServerCapabilities::builder()
489488
.enable_tools()
490489
.build(),
491-
server_info: rmcp::model::Implementation::default(),
492-
instructions: self.data.instructions.clone(),
490+
)
491+
.with_server_info(rmcp::model::Implementation::default())
492+
.with_protocol_version(rmcp::model::ProtocolVersion::default());
493+
494+
if let Some(instr) = self.data.instructions.clone() {
495+
base.with_instructions(instr)
496+
} else {
497+
base
493498
}
494499
}
495500
}
@@ -505,18 +510,20 @@ trait ErasedMcpTool<Counterpart: Role>: Send + Sync {
505510

506511
/// Create an `rmcp` tool model from our [`McpTool`] trait.
507512
fn make_tool_model<R: Role, M: McpTool<R>>(tool: &M) -> Tool {
508-
rmcp::model::Tool {
509-
name: tool.name().into(),
510-
title: tool.title(),
511-
description: Some(tool.description().into()),
512-
input_schema: schema_for_type::<M::Input>(),
513+
{
514+
rmcp::model::Tool::new(
515+
tool.name(),
516+
tool.description(),
517+
schema_for_type::<M::Input>(),
518+
)
513519
// schema_for_output returns Err for non-object types (strings, integers, etc.)
514520
// since MCP structured output requires JSON objects. We use .ok() to set
515521
// output_schema to None for these tools, signaling unstructured output.
516-
output_schema: schema_for_output::<M::Output>().ok(),
517-
annotations: None,
518-
icons: None,
519-
meta: None,
522+
.with_raw_output_schema(schema_for_output::<M::Output>().ok())
523+
.with_annotations(None)
524+
.with_icons(None)
525+
.with_meta(None)
526+
.with_execution(Some(rmcp::model::ToolExecution::new()))
520527
}
521528
}
522529

0 commit comments

Comments
 (0)