pub struct Router { /* private fields */ }Expand description
Central routing table — maps method names to handlers.
Implementations§
Source§impl Router
impl Router
pub fn new() -> Self
pub fn add_tool(&mut self, tool: Tool, handler: ToolHandlerFn)
pub fn list_tools(&self, _cursor: Option<&str>) -> ListToolsResult
pub async fn call_tool(&self, req: CallToolRequest) -> McpResult<CallToolResult>
pub fn add_resource(&mut self, resource: Resource, handler: ResourceHandlerFn)
pub fn add_resource_template( &mut self, template: ResourceTemplate, handler: ResourceHandlerFn, )
pub fn list_resources(&self, _cursor: Option<&str>) -> ListResourcesResult
pub async fn read_resource( &self, req: ReadResourceRequest, ) -> McpResult<ReadResourceResult>
pub fn add_prompt(&mut self, prompt: Prompt, handler: PromptHandlerFn)
pub fn list_prompts(&self, _cursor: Option<&str>) -> ListPromptsResult
pub async fn get_prompt( &self, req: GetPromptRequest, ) -> McpResult<GetPromptResult>
pub fn has_tools(&self) -> bool
pub fn has_resources(&self) -> bool
pub fn has_prompts(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Router
impl !RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl UnsafeUnpin for Router
impl !UnwindSafe for Router
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more