Table of Contents

Method HandleMessageAsync

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

HandleMessageAsync(string, McpRequestContext, CancellationToken)

Handles one incoming JSON-RPC message and produces the reply.

public Task<string> HandleMessageAsync(string requestJson, McpRequestContext context, CancellationToken cancellationToken = default)

Parameters

requestJson string

The raw JSON-RPC message.

context McpRequestContext

Session and caller identity for this message. The server fills in the progress token when the caller supplied one.

cancellationToken CancellationToken

A token to observe while handling.

Returns

Task<string>

The serialized reply, or null when the message was a notification and therefore takes no response.

Remarks

This method does not throw for malformed input or failing tools. Protocol faults come back as JSON-RPC errors and tool faults as results carrying isError, because a transport exception would leave the caller with nothing to act on.

Share