import { ToolDefinition } from './schema.js'; /** * Tool Loader - Loads and validates YAML/JSON tool definitions * Implements TDD pattern: test failures guide implementation * Features caching for efficient discovery with thousands of tools */ export declare class ToolLoader { /** * Static cache for discovered paths - populated on first autoDiscover call * Subsequent calls return cached result (O(1) instead of O(n)) */ private static discoveredPathsCache; /** * Discover packages using only fs and path (no createRequire needed) * Searches for tools in node_modules/@matimo/* and workspace packages. * Tries process.cwd() first, then falls back to __dirname-based discovery * (critical for Claude Desktop where cwd may be '/' on macOS). */ private getNodeModulesPath; /** * Load a single tool from a YAML or JSON file * @param filePath - Path to tool definition file * @returns Validated tool definition * @throws {Error} If file not found or invalid schema */ loadToolFromFile(filePath: string): ToolDefinition; /** * Load all tools from a directory * @param dirPath - Path to directory containing tool files * @returns Map of tool names to definitions * @note Prefers definition.yaml/definition.json over tool.yaml/tool.json */ loadToolsFromDirectory(dirPath: string): Map; /** * Load a tool from a JSON object * @param data - Tool definition as object * @returns Validated tool definition */ loadToolFromObject(data: unknown): ToolDefinition; /** * Auto-discover tool packages in node_modules/@matimo/* and core tools * Features efficient caching: first call discovers, subsequent calls return cached result * @returns Array of paths to tool directories */ autoDiscoverPackages(): string[]; /** * Clear the discovery cache (useful for testing or dynamic tool loading scenarios) * @internal Used for testing only */ static clearDiscoveryCache(): void; /** * Load tools from multiple directories * @param dirPaths - Array of directory paths * @returns Combined map of all tools */ loadToolsFromMultiplePaths(dirPaths: string[]): Map; } export default ToolLoader; //# sourceMappingURL=tool-loader.d.ts.map