@@ -5,10 +5,11 @@ use crate::{error::ServiceResult, fs_service::FileSystemService, tools::*};
55use async_trait:: async_trait;
66use rust_mcp_sdk:: McpServer ;
77use rust_mcp_sdk:: mcp_server:: ServerHandler ;
8- use rust_mcp_sdk:: schema:: RootsListChangedNotification ;
98use rust_mcp_sdk:: schema:: {
10- CallToolRequest , CallToolResult , InitializeRequest , InitializeResult , ListToolsRequest ,
11- ListToolsResult , RpcError , schema_utils:: CallToolError ,
9+ CallToolRequestParams , InitializeRequestParams , NotificationParams , PaginatedRequestParams ,
10+ } ;
11+ use rust_mcp_sdk:: schema:: {
12+ CallToolResult , InitializeResult , ListToolsResult , RpcError , schema_utils:: CallToolError ,
1213} ;
1314use std:: cmp:: Ordering ;
1415use std:: sync:: Arc ;
@@ -94,7 +95,7 @@ impl FileSystemHandler {
9495 // client supports roots
9596 let fs_service = self . fs_service . clone ( ) ;
9697 // retrieve roots from the client and update the allowed directories accordingly
97- let roots = match runtime. clone ( ) . list_roots ( None ) . await {
98+ let roots = match runtime. clone ( ) . request_root_list ( None ) . await {
9899 Ok ( roots_result) => roots_result. roots ,
99100 Err ( _err) => {
100101 vec ! [ ]
@@ -144,7 +145,7 @@ impl ServerHandler for FileSystemHandler {
144145
145146 async fn handle_roots_list_changed_notification (
146147 & self ,
147- _notification : RootsListChangedNotification ,
148+ _params : Option < NotificationParams > ,
148149 runtime : Arc < dyn McpServer > ,
149150 ) -> std:: result:: Result < ( ) , RpcError > {
150151 if self . mcp_roots_support {
@@ -160,7 +161,7 @@ impl ServerHandler for FileSystemHandler {
160161
161162 async fn handle_list_tools_request (
162163 & self ,
163- _ : ListToolsRequest ,
164+ _params : Option < PaginatedRequestParams > ,
164165 _: Arc < dyn McpServer > ,
165166 ) -> std:: result:: Result < ListToolsResult , RpcError > {
166167 Ok ( ListToolsResult {
@@ -172,33 +173,29 @@ impl ServerHandler for FileSystemHandler {
172173
173174 async fn handle_initialize_request (
174175 & self ,
175- initialize_request : InitializeRequest ,
176+ params : InitializeRequestParams ,
176177 runtime : Arc < dyn McpServer > ,
177178 ) -> std:: result:: Result < InitializeResult , RpcError > {
178179 runtime
179- . set_client_details ( initialize_request . params . clone ( ) )
180+ . set_client_details ( params. clone ( ) )
180181 . await
181182 . map_err ( |err| RpcError :: internal_error ( ) . with_message ( format ! ( "{err}" ) ) ) ?;
182183
183184 let mut server_info = runtime. server_info ( ) . to_owned ( ) ;
184185 // Provide compatibility for clients using older MCP protocol versions.
185- if server_info
186- . protocol_version
187- . cmp ( & initialize_request. params . protocol_version )
188- == Ordering :: Greater
189- {
190- server_info. protocol_version = initialize_request. params . protocol_version ;
186+ if server_info. protocol_version . cmp ( & params. protocol_version ) == Ordering :: Greater {
187+ server_info. protocol_version = params. protocol_version ;
191188 }
192189 Ok ( server_info)
193190 }
194191
195192 async fn handle_call_tool_request (
196193 & self ,
197- request : CallToolRequest ,
194+ params : CallToolRequestParams ,
198195 _: Arc < dyn McpServer > ,
199196 ) -> std:: result:: Result < CallToolResult , CallToolError > {
200197 let tool_params: FileSystemTools =
201- FileSystemTools :: try_from ( request . params ) . map_err ( CallToolError :: new) ?;
198+ FileSystemTools :: try_from ( params) . map_err ( CallToolError :: new) ?;
202199
203200 // Verify write access for tools that modify the file system
204201 if tool_params. require_write_access ( ) {
0 commit comments