Skip to main content

NotificationSink

Type Alias NotificationSink 

Source
pub type NotificationSink = Box<dyn Fn(JsonRpcNotification) + Send + Sync>;
Expand description

Callback used by tools to emit notifications/progress messages back to the MCP client while a long-running tools/call is still in flight.

FALSIFY-MCP-PROGRESS-001: in stdio mode the dispatcher passes a sink that writes each notification as one JSON line to the shared stdout handle (guarded by the same mutex as final responses). In-process tests use an Arc<Mutex<Vec<_>>>-backed sink to assert the outgoing wire format.

Must be Send because the sink is moved into the worker thread that run_stdio spawns for every tools/call.

Aliased Type§

pub struct NotificationSink(/* private fields */);