pub struct ProtocolHandler;Expand description
Protocol handler for MCP messages
Implementations§
Source§impl ProtocolHandler
impl ProtocolHandler
Sourcepub fn validate_request(&self, request: &JsonRpcRequest) -> Result<()>
pub fn validate_request(&self, request: &JsonRpcRequest) -> Result<()>
Validate a JSON-RPC request
Sourcepub fn parse_tool_call(&self, params: Option<Value>) -> Result<ToolCallParams>
pub fn parse_tool_call(&self, params: Option<Value>) -> Result<ToolCallParams>
Parse tool call parameters
Sourcepub fn create_tool_list_response(
&self,
id: RequestId,
tools: Vec<ToolDefinition>,
) -> JsonRpcResponse
pub fn create_tool_list_response( &self, id: RequestId, tools: Vec<ToolDefinition>, ) -> JsonRpcResponse
Create a tool list response
Sourcepub fn create_tool_result_response(
&self,
id: RequestId,
result: ToolResult,
) -> JsonRpcResponse
pub fn create_tool_result_response( &self, id: RequestId, result: ToolResult, ) -> JsonRpcResponse
Create a tool result response
Sourcepub fn create_error_response(
&self,
id: RequestId,
error: Error,
) -> JsonRpcResponse
pub fn create_error_response( &self, id: RequestId, error: Error, ) -> JsonRpcResponse
Create an error response from an error
Sourcepub fn handle_initialize(&self, id: RequestId) -> JsonRpcResponse
pub fn handle_initialize(&self, id: RequestId) -> JsonRpcResponse
Handle initialization request
Sourcepub fn handle_ping(&self, id: RequestId) -> JsonRpcResponse
pub fn handle_ping(&self, id: RequestId) -> JsonRpcResponse
Handle ping request
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProtocolHandler
impl RefUnwindSafe for ProtocolHandler
impl Send for ProtocolHandler
impl Sync for ProtocolHandler
impl Unpin for ProtocolHandler
impl UnwindSafe for ProtocolHandler
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