@@ -5,7 +5,7 @@ use mcp_core::protocol::{
55} ;
66use serde:: { Deserialize , Serialize } ;
77use serde_json:: Value ;
8- use std:: sync:: atomic:: { AtomicU64 , Ordering } ;
8+ use std:: { future :: Future , sync:: atomic:: { AtomicU64 , Ordering } } ;
99use thiserror:: Error ;
1010use tokio:: sync:: Mutex ;
1111use tower:: { Service , ServiceExt } ; // for Service::ready()
@@ -75,28 +75,27 @@ pub struct InitializeParams {
7575 pub client_info : ClientInfo ,
7676}
7777
78- #[ async_trait:: async_trait]
7978pub trait McpClientTrait : Send + Sync {
80- async fn initialize (
79+ fn initialize (
8180 & mut self ,
8281 info : ClientInfo ,
8382 capabilities : ClientCapabilities ,
84- ) -> Result < InitializeResult , Error > ;
83+ ) -> impl Future < Output = Result < InitializeResult , Error > > + Send ;
8584
86- async fn list_resources (
85+ fn list_resources (
8786 & self ,
8887 next_cursor : Option < String > ,
89- ) -> Result < ListResourcesResult , Error > ;
88+ ) -> impl Future < Output = Result < ListResourcesResult , Error > > + Send ;
9089
91- async fn read_resource ( & self , uri : & str ) -> Result < ReadResourceResult , Error > ;
90+ fn read_resource ( & self , uri : & str ) -> impl Future < Output = Result < ReadResourceResult , Error > > + Send ;
9291
93- async fn list_tools ( & self , next_cursor : Option < String > ) -> Result < ListToolsResult , Error > ;
92+ fn list_tools ( & self , next_cursor : Option < String > ) -> impl Future < Output = Result < ListToolsResult , Error > > + Send ;
9493
95- async fn call_tool ( & self , name : & str , arguments : Value ) -> Result < CallToolResult , Error > ;
94+ fn call_tool ( & self , name : & str , arguments : Value ) -> impl Future < Output = Result < CallToolResult , Error > > + Send ;
9695
97- async fn list_prompts ( & self , next_cursor : Option < String > ) -> Result < ListPromptsResult , Error > ;
96+ fn list_prompts ( & self , next_cursor : Option < String > ) -> impl Future < Output = Result < ListPromptsResult , Error > > + Send ;
9897
99- async fn get_prompt ( & self , name : & str , arguments : Value ) -> Result < GetPromptResult , Error > ;
98+ fn get_prompt ( & self , name : & str , arguments : Value ) -> impl Future < Output = Result < GetPromptResult , Error > > + Send ;
10099}
101100
102101/// The MCP client is the interface for MCP operations.
@@ -232,7 +231,6 @@ where
232231 }
233232}
234233
235- #[ async_trait:: async_trait]
236234impl < S > McpClientTrait for McpClient < S >
237235where
238236 S : Service < JsonRpcMessage , Response = JsonRpcMessage > + Clone + Send + Sync + ' static ,
0 commit comments