Table of Contents

Delegate McpRequestHandler<TParams, TResult>

Namespace
ModelContextProtocol.Server
Assembly
ModelContextProtocol.Core.dll

Delegate type for handling incoming MCP requests with specific parameter and result types.

public delegate ValueTask<TResult> McpRequestHandler<TParams, TResult>(RequestContext<TParams> request, CancellationToken cancellationToken)

Parameters

request RequestContext<TParams>

The request context containing the parameters and other metadata.

cancellationToken CancellationToken

A cancellation token to cancel the operation.

Returns

ValueTask<TResult>

A task representing the asynchronous operation, with the result of the handler.

Type Parameters

TParams

The type of the parameters sent with the request.

TResult

The type of the response returned by the handler.