/** * Transport-independent JSON-RPC routing for the MCP server. * * `routeMcpMessage` answers everything a server can answer without running a * tool (initialize, ping, tools/list, protocol errors) and hands a `tools/call` * back to the transport as a pending call. The transport decides how to run it: * stdio runs it synchronously, HTTP awaits it after authorization. That split * keeps one protocol implementation while letting each transport own its side * effects. */ import { type JsonRpcResponse } from './mcp-protocol.js'; import type { McpToolDefinition } from './mcp-tool-definitions.js'; /** What a transport announces about itself in `initialize`. */ export interface McpServerDescription { /** Guidance for the model: the loop and what `render` returns on this transport. */ instructions: string; } /** The outcome of routing one JSON-RPC message. */ export type McpRoute = { kind: 'reply'; response: JsonRpcResponse; } | { kind: 'silent'; } | { kind: 'call'; id: string | number; tool: T; args: Record; }; /** True when the message is a JSON-RPC response sent to us, which needs no reply. */ export declare function isJsonRpcResponse(message: unknown): boolean; /** * Route one JSON-RPC message against a tool list. Notifications and responses * sent to us are silent; everything else either gets a reply now or becomes a * pending tool call. */ export declare function routeMcpMessage(message: unknown, tools: readonly T[], server: McpServerDescription): McpRoute; //# sourceMappingURL=mcp-json-rpc-dispatch.d.ts.map