Skip to content
docsv0.5.1

McpRespondedEvent

Dispatched by {@see \Milpa\McpServer\JsonRpcService::handle()} as the `mcp.responded` POST event, once a JSON-RPC response array has been computed for a resolved method — whatever produced it: the method actually ran, a listener short-circuited `mcp.request` with a canned response, or a listener vetoed the method and this carries the resulting error response. Always readonly (family convention, core 0.5 KEYSTONE) — pure post-hoc notification, no slot, nothing a listener can mutate. Fires unconditionally, including for notifications (a request with no `id` member): `handle()` still returns `null` on the wire for those per the 0.2 null-signal contract, but this event still carries the response that WOULD have been sent, for observability.

McpRespondedEvent::__construct()

public function __construct(string $method, array $response):

Parameters

Parameters of __construct()
NameTypeDescription
$methodstring
$responsearray<string, mixed>the full JSON-RPC response envelope (`jsonrpc`/`result-or-error`/`id`) — the exact array `handle()` would return for a non-notification

McpRespondedEvent::getMethod()

public function getMethod(): string

The JSON-RPC method that was dispatched (e.g. `tools/call`).

McpRespondedEvent::getResponse()

public function getResponse(): array

The full JSON-RPC response envelope produced for this request.