/** * Tool registration helper. Wraps MCP server.registerTool() with * 3-tier access checking, category filtering, blacklist/whitelist support, * and error handling. * * Hybrid pattern: Komodo's 3-tier numeric gating + AdGuard's * Promise handler with automatic error wrapping. */ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import type { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js"; import type { ZodRawShape } from "zod"; import type { AccessTier, AppConfig, ToolCategory } from "../types/index.js"; export interface ToolRegistrationOptions { name: string; title: string; description: string; accessTier: AccessTier; category: ToolCategory; annotations?: ToolAnnotations; inputSchema?: ZodRawShape; handler: (args: Record) => Promise; } /** * Register a tool with the MCP server, respecting blacklist/whitelist, * access tier, and category filters. * * Filter precedence: * 1. Blacklist always wins (even over whitelist — logs warning if both) * 2. Whitelist bypasses access tier and category filters * 3. Access tier gate * 4. Category gate * * Handlers return Promise. The wrapper wraps the result into MCP * response format and catches errors with sanitization. * * Returns true if the tool was registered, false if filtered out. */ export declare function registerTool(server: McpServer, config: AppConfig, options: ToolRegistrationOptions): boolean; /** * Validate that all tool names in blacklist/whitelist actually exist. * Call after registerAllTools() to warn about typos or stale entries. */ export declare function validateToolLists(config: AppConfig): void;