Skip to main content

handle_message

Function handle_message 

Source
pub async fn handle_message(state: &AppState, msg: Value) -> Value
Expand description

Handle a single MCP JSON-RPC message and produce its response.

Why: Pulled out of the stdio loop so unit tests can drive every method without touching real stdin/stdout. What: Routes initialize, tools/list, tools/call, ping, and the notifications/initialized notification (which returns Value::Null). Test: See unit tests below — initialize/list/call all return expected JSON-RPC envelopes; notifications return Null (no response written).