pub trait Router:
Send
+ Sync
+ 'static {
Show 17 methods
// Required methods
fn name(&self) -> String;
fn instructions(&self) -> String;
fn capabilities(&self) -> ServerCapabilities;
fn list_tools(&self) -> Vec<Tool>;
fn call_tool(
&self,
tool_name: &str,
arguments: Value,
) -> Pin<Box<dyn Future<Output = Result<Vec<Content>, ToolError>> + Send + 'static>>;
fn list_resources(&self) -> Vec<Resource>;
fn read_resource(
&self,
uri: &str,
) -> Pin<Box<dyn Future<Output = Result<String, ResourceError>> + Send + 'static>>;
fn list_prompts(&self) -> Vec<Prompt>;
fn get_prompt(
&self,
prompt_name: &str,
) -> Pin<Box<dyn Future<Output = Result<String, PromptError>> + Send + 'static>>;
// Provided methods
fn create_response(&self, id: Option<u64>) -> JsonRpcResponse { ... }
fn handle_initialize(
&self,
req: JsonRpcRequest,
) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send { ... }
fn handle_tools_list(
&self,
req: JsonRpcRequest,
) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send { ... }
fn handle_tools_call(
&self,
req: JsonRpcRequest,
) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send { ... }
fn handle_resources_list(
&self,
req: JsonRpcRequest,
) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send { ... }
fn handle_resources_read(
&self,
req: JsonRpcRequest,
) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send { ... }
fn handle_prompts_list(
&self,
req: JsonRpcRequest,
) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send { ... }
fn handle_prompts_get(
&self,
req: JsonRpcRequest,
) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send { ... }
}
Required Methods§
fn name(&self) -> String
fn instructions(&self) -> String
fn capabilities(&self) -> ServerCapabilities
fn list_tools(&self) -> Vec<Tool>
fn call_tool( &self, tool_name: &str, arguments: Value, ) -> Pin<Box<dyn Future<Output = Result<Vec<Content>, ToolError>> + Send + 'static>>
fn list_resources(&self) -> Vec<Resource>
fn read_resource( &self, uri: &str, ) -> Pin<Box<dyn Future<Output = Result<String, ResourceError>> + Send + 'static>>
fn list_prompts(&self) -> Vec<Prompt>
fn get_prompt( &self, prompt_name: &str, ) -> Pin<Box<dyn Future<Output = Result<String, PromptError>> + Send + 'static>>
Provided Methods§
fn create_response(&self, id: Option<u64>) -> JsonRpcResponse
fn handle_initialize( &self, req: JsonRpcRequest, ) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send
fn handle_tools_list( &self, req: JsonRpcRequest, ) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send
fn handle_tools_call( &self, req: JsonRpcRequest, ) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send
fn handle_resources_list( &self, req: JsonRpcRequest, ) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send
fn handle_resources_read( &self, req: JsonRpcRequest, ) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send
fn handle_prompts_list( &self, req: JsonRpcRequest, ) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send
fn handle_prompts_get( &self, req: JsonRpcRequest, ) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.