Table of Contents

Event Sending

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

Invoked immediately before sending an HTTP request to the server.

public event EventHandler<McpRequestSendingEventArgs> Sending

Returns

EventHandler<McpRequestSendingEventArgs>

An action receiving:

  • method: e.g., "tools/list", "initialize", or a prefixed log label
  • parameters: the exact parameters object that will be sent (may be null)

Examples

client.OnSending = (method, parameters) =>
{
    string paramJson;
    try { paramJson = parameters == null ? "null" : JsonSerializer.Serialize(parameters); }
    catch { paramJson = "<unserializable>"; }
    Console.WriteLine($"Sending: {method} | params: {paramJson}");
};

Remarks

Keep the handler lightweight; exceptions will propagate.