This project implements the Model Context Protocol (MCP). All communication follows the JSON-RPC pattern using these core types:
MCPRequest: The standard envelope containing jsonrpc, id, method, and params.MCPResponse: The standard successful response containing result.MCPErrorResponse: The error response containing an MCPError object.MCPError: Contains a numeric code and a message.
Tool execution is handled via ExecuteToolFunctionParams, which specifies the function name and its arguments (as a JSON Value).
#[derive(Debug, Deserialize, Serialize)]
pub struct MCPRequest {
pub jsonrpc: String,
pub id: Value,
pub method: String,
pub params: Option<Value>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct MCPResponse {
pub jsonrpc: String,
pub id: Value,
pub result: Value,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct MCPErrorResponse {
pub jsonrpc: String,
pub id: Value,
pub error: MCPError,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct MCPError {
pub code: i32,
pub message: String,
pub data: Option<Value>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct ExecuteToolFunctionParams {
pub function: String,
pub arguments: Value,
}