ServerPushChannel.requestOnSession

MODE 3 — REQUEST ON SESSION. Send a server->client JSON-RPC *request* (elicit / sample / roots / server-initiated ping) on the GET SSE stream of the session named by sessionToken, and block until that client responds. The reply arrives on a *separate* POST to the MCP endpoint and is routed through StreamCoordinator.resolve, which wakes this call.

Correlation is keyed by (sessionToken, id): the waiter is registered under the session, the request frame is delivered only on a listener whose Listener.ownerToken matches, and only a response POSTed under the SAME session resolves it — so a reply arriving on another session can never resolve this one's pending request. The empty token is the stateless / shared path (any unscoped listener, resolvable only by an unscoped reply).

Returns the client's result, or throws McpException on a client error or timeout. Throws internalError if no matching GET listener is connected (there is nobody to answer). The request/response counterpart to broadcast / pushToSession, and the foundation for the server-initiated ping.

class ServerPushChannel
@safe
Json
requestOnSession
(,
string method
,
Json params = Json.emptyObject
,
Duration timeout = 60.seconds
)