/** * MCP tool registration for skill-related tools. * * - skill: Load and activate a skill by name (returns SKILL.md content) * - skill-resource: Read files within a skill directory (scripts/, references/, assets/, etc.) * * Tools reference a shared SkillState object to support dynamic skill updates * when MCP roots change. */ import { McpServer, RegisteredTool } from "@modelcontextprotocol/sdk/server/mcp.js"; import { SkillMetadata } from "./skill-discovery.js"; /** * Shared state for dynamic skill management. * Tools reference this state object, allowing updates when roots change. */ export interface SkillState { skillMap: Map; } /** * Register the "skill" tool with the MCP server. * * The tool description includes the full skill discovery instructions (same format as * server instructions) to enable dynamic updates via tools/listChanged notifications. * * @param server - The McpServer instance * @param skillState - Shared state object (allows dynamic updates) * @returns The registered tool, which can be updated when skills change */ /** * Generate the full tool description including usage guidance and skill list. * Exported so index.ts can use it when refreshing skills. */ export declare function getToolDescription(skillState: SkillState): string; export declare function registerSkillTool(server: McpServer, skillState: SkillState): RegisteredTool; export declare const MAX_FILE_SIZE: number; export declare const MAX_DIRECTORY_DEPTH = 10; /** * Check if a path is within the allowed base directory. * Uses fs.realpathSync to resolve symlinks and prevent symlink escape attacks. */ export declare function isPathWithinBase(targetPath: string, baseDir: string): boolean; /** * List files in a skill directory for discovery. * Limits recursion depth to prevent DoS from deeply nested directories. */ export declare function listSkillFiles(skillDir: string, subPath?: string, depth?: number): string[];