Table of Contents

Delegate McpRequestInvocationFilter<TParams, TResult>

Namespace
ModelContextProtocol.Server
Assembly
ModelContextProtocol.Core.dll

Delegate type for filtering a single incoming MCP request invocation.

[Experimental("MCPEXP002", UrlFormat = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp002")]
public delegate ValueTask<TResult> McpRequestInvocationFilter<TParams, TResult>(RequestContext<TParams> context, McpRequestHandler<TParams, TResult> next, CancellationToken cancellationToken)

Parameters

context RequestContext<TParams>

The context for the current request.

next McpRequestHandler<TParams, TResult>

The next request handler in the pipeline for this invocation.

cancellationToken CancellationToken

The cancellation token for the current request.

Returns

ValueTask<TResult>

The result of the filtered request invocation.

Type Parameters

TParams

The type of the parameters sent with the request.

TResult

The type of the response returned by the handler.