Interface IMcpClient

Assembly: redb.Route.Llm.Mcp.dll

Transport-agnostic MCP client. Implementations spawn / hold the connection,
perform the protocol handshake, and dispatch tools/call requests
against a single MCP server. Lifetime is owned by the host (singleton in DI).

public interface IMcpClient : IAsyncDisposable

Properties

Initialize

Server identification reported during initialize; null until handshake completes.

InitializeResult? Initialize { get; }

ServerName

Logical server name as registered with .

string ServerName { get; }

Status

Current health state of the client.

McpClientStatus Status { get; }

Methods

CallToolAsync(string, JsonNode?, CancellationToken)

Invokes a tool via tools/call. On cancellationToken trip the client

Task<CallToolResult> CallToolAsync(string toolName, JsonNode? arguments, CancellationToken cancellationToken = default)

InitializeAsync(CancellationToken)

Performs the initialize handshake. Must be called before any other method.

Task InitializeAsync(CancellationToken cancellationToken = default)

ListToolsAsync(CancellationToken)

Returns the current tool catalogue via tools/list.

Task<IReadOnlyList<ToolDefinition>> ListToolsAsync(CancellationToken cancellationToken = default)