Path: redb-route/redb.Route.Llm.Mcp/Protocol/IMcpClient.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Llm.Mcp/Protocol/IMcpClient.cs ---- using System.Text.Json.Nodes; using redb.Route.Llm.Mcp.Protocol; namespace redb.Route.Llm.Mcp; /// /// Health state of an . Surfaced by /// so observers can drop dead servers from the agent toolset. /// public enum McpClientStatus { /// Not yet started. Idle, /// Currently performing the initialize + tools/list handshake. Connecting, /// Connected and ready to handle tools/call. Healthy, /// Lost connection — auto-restart in flight. Restarting, /// Restart budget exhausted — stays dead until a manual restart. Dead } /// /// 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 { /// Logical server name as registered with . string ServerName { get; } /// Current health state of the client. McpClientStatus Status { get; } /// Server identification reported during initialize; null until handshake completes. InitializeResult? Initialize { get; } /// /// Raised after a notifications/tools/list_changed from the server, /// or after the client reconnects (so the registry refreshes the descriptor set). /// event EventHandler? ToolsChanged; /// Performs the initialize handshake. Must be called before any other method. Task InitializeAsync(CancellationToken cancellationToken = default); /// Returns the current tool catalogue via tools/list. Task> ListToolsAsync(CancellationToken cancellationToken = default); /// /// Invokes a tool via tools/call. On trip the client /// sends a notifications/cancelled for the in-flight id and removes the pending TCS. /// /// Server-side tool name. /// Arguments matching the tool's inputSchema; null = empty object. /// Cancellation token. Task CallToolAsync(string toolName, JsonNode? arguments, CancellationToken cancellationToken = default); }