Table of Contents

Event Received

Namespace
LMKit.Mcp.Client
Assembly
LM-Kit.NET.dll

Gets or sets a callback invoked after receiving an HTTP response from the server.

public event EventHandler<McpResponseReceivedEventArgs> Received

Returns

EventHandler<McpResponseReceivedEventArgs>

An action that receives three parameters: the JSON-RPC method name, the HTTP status code, and a truncated snippet of the response body (up to 512 characters). Default is null.

Examples

client.OnReceived = (method, statusCode, body) => 
{
    Console.WriteLine($"Received {statusCode} for {method}: {body}");
};

Remarks

Use this callback for logging, metrics, or debugging server responses. The response body snippet is truncated for safety and to avoid excessive logging. For SSE responses, the snippet shows the extracted JSON-RPC payload.

Important: This callback should not throw exceptions, as they may interfere with request processing.