McpServer.notify

Send an *unsolicited* JSON-RPC notification to every client currently listening on the standalone GET SSE stream. This is the public entry point for server-initiated traffic outside an in-flight request — e.g. a notifications/resources/updated for a subscribed resource, or a notifications/tools/list_changed. Returns the number of listeners the notification was delivered to; 0 when no GET stream is open (or the server is not on a Streamable HTTP transport). On a stdio server with an active draft subscriptions/listen it is additionally written to stdout (stamped with the listen subscriptionId), since that transport shares one channel for all server->client traffic.

class McpServer
@safe
size_t
notify
(
string method
,
Json params = Json.undefined
)