/** * Dynamic MCP tool registration for passthrough mode. * * In passthrough mode, OpenCode's tools need to be real callable tools * (not just text descriptions in the prompt). We create an MCP server * that registers each tool from OpenCode's request with the exact * name and schema, so Claude generates proper tool_use blocks. * * Tool handlers are no-ops — the PreToolUse hook blocks execution. * We just need the definitions so Claude can call them. */ export declare const PASSTHROUGH_MCP_NAME = "oc"; export declare const PASSTHROUGH_MCP_PREFIX = "mcp__oc__"; export declare function getAutoDeferThreshold(): number; /** * Create an MCP server with tool definitions matching OpenCode's request. * * Auto-defer: when the tool count exceeds the threshold and coreToolNames * is provided, non-core tools are registered without alwaysLoad so the SDK * defers them. Core tools are marked alwaysLoad to stay in the prompt. * Client-provided defer_loading: true also triggers deferral for specific tools. */ export declare function createPassthroughMcpServer(tools: Array<{ name: string; description?: string; input_schema?: any; defer_loading?: boolean; }>, coreToolNames?: readonly string[]): { server: import("@anthropic-ai/claude-agent-sdk").McpSdkServerConfigWithInstance; toolNames: string[]; hasDeferredTools: boolean; }; /** * Stable cache key for a tool set — name + input schema, sorted. * Schema is included so silently-updated tool definitions force a rebuild * of the cached MCP server. */ export declare function computeToolSetKey(tools: Array<{ name: string; input_schema?: unknown; defer_loading?: boolean; }>): string; /** * Strip the MCP prefix from a tool name to get the OpenCode tool name. * e.g., "mcp__oc__todowrite" → "todowrite" */ export declare function stripMcpPrefix(toolName: string): string; /** * Normalize tool input parameter names to match the client's schema. * * The Claude Code SDK's system prompt references built-in tools with * snake_case parameter names (e.g., file_path), but clients like OpenCode * may use camelCase (e.g., filePath). When the model generates a tool call * using the SDK's naming convention instead of the MCP schema's convention, * required parameters appear undefined on the client side. * * This function detects unrecognized keys, tries snake_case ↔ camelCase * conversion, and remaps them when a match exists in the client's schema. * It only activates when at least one required parameter is missing, so * well-formed tool calls pass through untouched. */ export declare function normalizeToolInput(input: Record | undefined, clientSchema: { properties?: Record; required?: string[]; } | undefined): Record | undefined; //# sourceMappingURL=passthroughTools.d.ts.map