Skip to content

Commit 05f4729

Browse files
authored
feat: update to latest version of rust-mcp-schema (#9)
* feat: update to latest version of rust-mcp-schema * Update multiple dependencies to use latest minor versions
1 parent 9cda30c commit 05f4729

25 files changed

+257
-217
lines changed

Cargo.lock

Lines changed: 17 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ members = [
1313

1414
[workspace.dependencies]
1515
# Workspace member crates
16-
rust-mcp-transport = { version = "0.1.1", path = "crates/rust-mcp-transport" }
16+
rust-mcp-transport = { version = "0.1", path = "crates/rust-mcp-transport" }
1717
rust-mcp-sdk = { path = "crates/rust-mcp-sdk" }
18-
rust-mcp-macros = { version = "0.1.2", path = "crates/rust-mcp-macros" }
18+
rust-mcp-macros = { version = "0.1", path = "crates/rust-mcp-macros" }
1919

2020
# External crates
21-
rust-mcp-schema = { version = "0.2.2" }
21+
rust-mcp-schema = { version = "0.3" }
2222
futures = { version = "0.3" }
23-
tokio = { version = "1.44.1", features = ["full"] }
24-
serde = { version = "1.0.219", features = ["derive", "serde_derive"] }
25-
serde_json = { version = "1.0.140" }
26-
async-trait = { version = "0.1.88" }
27-
strum = { version = "0.27.0", features = ["derive"] }
28-
thiserror = { version = "2.0.12" }
29-
tokio-stream = { version = "0.1.17" }
23+
tokio = { version = "1.4", features = ["full"] }
24+
serde = { version = "1.0", features = ["derive", "serde_derive"] }
25+
serde_json = { version = "1.0" }
26+
async-trait = { version = "0.1" }
27+
strum = { version = "0.27", features = ["derive"] }
28+
thiserror = { version = "2.0" }
29+
tokio-stream = { version = "0.1" }
3030

3131

3232
# [workspace.dependencies.windows]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub struct MyServerHandler;
7070
#[async_trait]
7171
impl ServerHandler for MyServerHandler {
7272
// Handle ListToolsRequest, return list of available tools as ListToolsResult
73-
async fn handle_list_tools_request(&self, request: ListToolsRequest, runtime: &dyn MCPServer) -> Result<ListToolsResult, JsonrpcErrorError> {
73+
async fn handle_list_tools_request(&self, request: ListToolsRequest, runtime: &dyn MCPServer) -> Result<ListToolsResult, RpcError> {
7474

7575
Ok(ListToolsResult {
7676
tools: vec![SayHelloTool::get_tool()],

crates/rust-mcp-sdk/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub struct MyServerHandler;
7070
#[async_trait]
7171
impl ServerHandler for MyServerHandler {
7272
// Handle ListToolsRequest, return list of available tools as ListToolsResult
73-
async fn handle_list_tools_request(&self, request: ListToolsRequest, runtime: &dyn MCPServer) -> Result<ListToolsResult, JsonrpcErrorError> {
73+
async fn handle_list_tools_request(&self, request: ListToolsRequest, runtime: &dyn MCPServer) -> Result<ListToolsResult, RpcError> {
7474

7575
Ok(ListToolsResult {
7676
tools: vec![SayHelloTool::get_tool()],

crates/rust-mcp-sdk/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rust_mcp_schema::JsonrpcErrorError;
1+
use rust_mcp_schema::RpcError;
22
use rust_mcp_transport::error::TransportError;
33
use thiserror::Error;
44

@@ -7,7 +7,7 @@ pub type SdkResult<T> = core::result::Result<T, MCPSdkError>;
77
#[derive(Debug, Error)]
88
pub enum MCPSdkError {
99
#[error("{0}")]
10-
JsonrpcErrorError(#[from] JsonrpcErrorError),
10+
RpcError(#[from] RpcError),
1111
#[error("{0}")]
1212
IoError(#[from] std::io::Error),
1313
#[error("{0}")]

crates/rust-mcp-sdk/src/mcp_handlers/mcp_client_handler.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use async_trait::async_trait;
22
use rust_mcp_schema::{
3-
CancelledNotification, CreateMessageRequest, CreateMessageResult, JsonrpcErrorError,
4-
ListRootsRequest, ListRootsResult, LoggingMessageNotification, PingRequest,
5-
ProgressNotification, PromptListChangedNotification, ResourceListChangedNotification,
6-
ResourceUpdatedNotification, Result, ToolListChangedNotification,
3+
CancelledNotification, CreateMessageRequest, CreateMessageResult, ListRootsRequest,
4+
ListRootsResult, LoggingMessageNotification, PingRequest, ProgressNotification,
5+
PromptListChangedNotification, ResourceListChangedNotification, ResourceUpdatedNotification,
6+
Result, RpcError, ToolListChangedNotification,
77
};
88
use serde_json::Value;
99

@@ -22,17 +22,17 @@ pub trait ClientHandler: Send + Sync + 'static {
2222
&self,
2323
request: PingRequest,
2424
runtime: &dyn MCPClient,
25-
) -> std::result::Result<Result, JsonrpcErrorError> {
25+
) -> std::result::Result<Result, RpcError> {
2626
Ok(Result::default())
2727
}
2828

2929
async fn handle_create_message_request(
3030
&self,
3131
request: CreateMessageRequest,
3232
runtime: &dyn MCPClient,
33-
) -> std::result::Result<CreateMessageResult, JsonrpcErrorError> {
33+
) -> std::result::Result<CreateMessageResult, RpcError> {
3434
runtime.assert_client_request_capabilities(request.method())?;
35-
Err(JsonrpcErrorError::method_not_found().with_message(format!(
35+
Err(RpcError::method_not_found().with_message(format!(
3636
"No handler is implemented for '{}'.",
3737
request.method(),
3838
)))
@@ -42,9 +42,9 @@ pub trait ClientHandler: Send + Sync + 'static {
4242
&self,
4343
request: ListRootsRequest,
4444
runtime: &dyn MCPClient,
45-
) -> std::result::Result<ListRootsResult, JsonrpcErrorError> {
45+
) -> std::result::Result<ListRootsResult, RpcError> {
4646
runtime.assert_client_request_capabilities(request.method())?;
47-
Err(JsonrpcErrorError::method_not_found().with_message(format!(
47+
Err(RpcError::method_not_found().with_message(format!(
4848
"No handler is implemented for '{}'.",
4949
request.method(),
5050
)))
@@ -54,8 +54,8 @@ pub trait ClientHandler: Send + Sync + 'static {
5454
&self,
5555
request: Value,
5656
runtime: &dyn MCPClient,
57-
) -> std::result::Result<ListRootsResult, JsonrpcErrorError> {
58-
Err(JsonrpcErrorError::method_not_found()
57+
) -> std::result::Result<ListRootsResult, RpcError> {
58+
Err(RpcError::method_not_found()
5959
.with_message("No handler is implemented for custom requests.".to_string()))
6060
}
6161

@@ -67,63 +67,63 @@ pub trait ClientHandler: Send + Sync + 'static {
6767
&self,
6868
notification: CancelledNotification,
6969
runtime: &dyn MCPClient,
70-
) -> std::result::Result<(), JsonrpcErrorError> {
70+
) -> std::result::Result<(), RpcError> {
7171
Ok(())
7272
}
7373

7474
async fn handle_progress_notification(
7575
&self,
7676
notification: ProgressNotification,
7777
runtime: &dyn MCPClient,
78-
) -> std::result::Result<(), JsonrpcErrorError> {
78+
) -> std::result::Result<(), RpcError> {
7979
Ok(())
8080
}
8181

8282
async fn handle_resource_list_changed_notification(
8383
&self,
8484
notification: ResourceListChangedNotification,
8585
runtime: &dyn MCPClient,
86-
) -> std::result::Result<(), JsonrpcErrorError> {
86+
) -> std::result::Result<(), RpcError> {
8787
Ok(())
8888
}
8989

9090
async fn handle_resource_updated_notification(
9191
&self,
9292
notification: ResourceUpdatedNotification,
9393
runtime: &dyn MCPClient,
94-
) -> std::result::Result<(), JsonrpcErrorError> {
94+
) -> std::result::Result<(), RpcError> {
9595
Ok(())
9696
}
9797

9898
async fn handle_prompt_list_changed_notification(
9999
&self,
100100
notification: PromptListChangedNotification,
101101
runtime: &dyn MCPClient,
102-
) -> std::result::Result<(), JsonrpcErrorError> {
102+
) -> std::result::Result<(), RpcError> {
103103
Ok(())
104104
}
105105

106106
async fn handle_tool_list_changed_notification(
107107
&self,
108108
notification: ToolListChangedNotification,
109109
runtime: &dyn MCPClient,
110-
) -> std::result::Result<(), JsonrpcErrorError> {
110+
) -> std::result::Result<(), RpcError> {
111111
Ok(())
112112
}
113113

114114
async fn handle_logging_message_notification(
115115
&self,
116116
notification: LoggingMessageNotification,
117117
runtime: &dyn MCPClient,
118-
) -> std::result::Result<(), JsonrpcErrorError> {
118+
) -> std::result::Result<(), RpcError> {
119119
Ok(())
120120
}
121121

122122
async fn handle_custom_notification(
123123
&self,
124124
notification: Value,
125125
runtime: &dyn MCPClient,
126-
) -> std::result::Result<(), JsonrpcErrorError> {
126+
) -> std::result::Result<(), RpcError> {
127127
Ok(())
128128
}
129129

@@ -132,17 +132,17 @@ pub trait ClientHandler: Send + Sync + 'static {
132132
//********************//
133133
async fn handle_error(
134134
&self,
135-
error: JsonrpcErrorError,
135+
error: RpcError,
136136
runtime: &dyn MCPClient,
137-
) -> std::result::Result<(), JsonrpcErrorError> {
137+
) -> std::result::Result<(), RpcError> {
138138
Ok(())
139139
}
140140

141141
async fn handle_process_error(
142142
&self,
143143
error_message: String,
144144
runtime: &dyn MCPClient,
145-
) -> std::result::Result<(), JsonrpcErrorError> {
145+
) -> std::result::Result<(), RpcError> {
146146
if !runtime.is_shut_down().await {
147147
eprintln!("Process error: {}", error_message);
148148
}

crates/rust-mcp-sdk/src/mcp_handlers/mcp_client_handler_core.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub trait ClientHandlerCore: Send + Sync + 'static {
2020
&self,
2121
request: RequestFromServer,
2222
runtime: &dyn MCPClient,
23-
) -> std::result::Result<ResultFromClient, JsonrpcErrorError>;
23+
) -> std::result::Result<ResultFromClient, RpcError>;
2424

2525
/// Asynchronously handles an incoming notification from the server.
2626
///
@@ -30,23 +30,23 @@ pub trait ClientHandlerCore: Send + Sync + 'static {
3030
&self,
3131
notification: NotificationFromServer,
3232
runtime: &dyn MCPClient,
33-
) -> std::result::Result<(), JsonrpcErrorError>;
33+
) -> std::result::Result<(), RpcError>;
3434

3535
/// Asynchronously handles an error received from the server.
3636
///
3737
/// # Parameters
3838
/// - `error` – The error data received from the MCP server.
3939
async fn handle_error(
4040
&self,
41-
error: JsonrpcErrorError,
41+
error: RpcError,
4242
runtime: &dyn MCPClient,
43-
) -> std::result::Result<(), JsonrpcErrorError>;
43+
) -> std::result::Result<(), RpcError>;
4444

4545
async fn handle_process_error(
4646
&self,
4747
error_message: String,
4848
runtime: &dyn MCPClient,
49-
) -> std::result::Result<(), JsonrpcErrorError> {
49+
) -> std::result::Result<(), RpcError> {
5050
if !runtime.is_shut_down().await {
5151
eprintln!("Process error: {}", error_message);
5252
}

0 commit comments

Comments
 (0)