/** * Child MCP Tool Delivery — 3-Level Fallback * * Determines how discovered child MCP tools should be surfaced * to the calling agent, based on the client's capabilities. * * ┌─────────────────────────────────────────────────────────────────┐ * │ Level │ When │ How │ * │───────│─────────────────────────────│──────────────────────────│ * │ 1 │ Client supports listChanged │ Native tool registration │ * │ 2 │ Known-good client (curated) │ Register + instruct │ * │ 3 │ Default / unknown client │ via bhived_use_tool │ * └─────────────────────────────────────────────────────────────────┘ * * IMPORTANT: Default to Level 3 (proxy). Reliability > convenience. */ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import type { ChildMcpTool } from "../registries/childMcpRegistry.js"; export type DeliveryLevel = 1 | 2 | 3; export interface DeliveryResult { /** Which level was used */ level: DeliveryLevel; /** Human-readable description of how tools are delivered */ description: string; /** If level 1/2: the native tool names registered. If level 3: empty. */ registeredToolNames: string[]; } export interface DeliveryContext { /** The McpServer instance (for registering native tools at level 1/2) */ server: McpServer; /** Whether the client declared tools.listChanged capability */ clientSupportsListChanged: boolean; /** Name identifier of the client application */ clientName?: string; } /** * Detect the appropriate delivery level based on client capabilities. */ export declare function detectDeliveryLevel(ctx: DeliveryContext): DeliveryLevel; /** * Execute the delivery strategy for a set of child MCP tools. * * Level 1 (Native): Register each tool as `{mcpName}__{toolName}` * and rely on the SDK to send `notifications/tools/list_changed`. * * Level 2 (Refresh): Same as Level 1, but also instruct the agent * to refresh the tool list. * * Level 3 (Proxy): Don't register native tools — everything goes * through `bhived_use_tool(mcp="...", tool="...", params={...})`. */ export declare function executeDelivery(level: DeliveryLevel, mcpName: string, tools: ChildMcpTool[], _ctx: DeliveryContext): DeliveryResult; /** * Build the full delivery result (detect + execute) in one call. */ export declare function deliverTools(mcpName: string, tools: ChildMcpTool[], ctx: DeliveryContext): DeliveryResult; /** * Build a namespaced tool name for Level 1/2 native registration. * Format: {mcpName}__{toolName} * * Reserved for future implementation. */ export declare function buildNativeToolName(mcpName: string, toolName: string): string; /** * Parse a namespaced tool name back into MCP and tool names. * * Reserved for future implementation. */ export declare function parseNativeToolName(nativeName: string): { mcpName: string; toolName: string; } | null; //# sourceMappingURL=delivery.d.ts.map