/** * search_by_path Tool * * Glob pattern file search MCP tool. Finds indexed files matching a glob pattern * (e.g., `**\/auth*.ts`). Useful when users know what file they're looking for * but not the exact path. * * Features: * - Standard glob pattern support (**, *, ?) * - Configurable result limit * - Case-sensitive matching * - Alphabetically sorted results */ import { z } from 'zod'; /** * Input schema for search_by_path tool * * Validates the glob pattern and optional limit parameter. */ export declare const SearchByPathInputSchema: z.ZodObject<{ pattern: z.ZodString; limit: z.ZodDefault; }, z.core.$strip>; /** * Inferred input type from schema */ export type SearchByPathInput = z.infer; /** * Output structure for search_by_path tool */ export interface SearchByPathOutput { /** Array of matching file paths (alphabetically sorted) */ matches: string[]; /** Total number of matches found (may be greater than matches.length if limited) */ totalMatches: number; } /** * Tool context containing the project path */ export interface ToolContext { /** Absolute path to the project root */ projectPath: string; } /** * Validate a glob pattern for correctness * * Checks for: * - Empty patterns * - Unmatched brackets * - Invalid escape sequences * - Other malformed patterns * * @param pattern - The glob pattern to validate * @returns Object with valid boolean and optional error message */ export declare function validateGlobPattern(pattern: string): { valid: boolean; error?: string; }; /** * Match files against a glob pattern * * @param files - Array of file paths to match against * @param pattern - Glob pattern to match * @param limit - Maximum number of results to return * @returns Array of matching file paths (sorted alphabetically) */ export declare function matchPattern(files: string[], pattern: string, limit: number): string[]; /** * Execute glob pattern search on the indexed files * * Searches the LanceDB index for files matching the provided glob pattern. * Pattern matching is case-sensitive. * * @param input - The search input containing pattern and optional limit * @param context - Tool context containing the project path * @returns Search results with matches and total count * @throws MCPError with INDEX_NOT_FOUND if no index exists for the project * @throws MCPError with INVALID_PATTERN for malformed glob patterns * * @example * ```typescript * const results = await searchByPath( * { pattern: '**\/*.ts', limit: 20 }, * { projectPath: '/path/to/project' } * ); * * console.log(results.matches); // ['src/index.ts', 'src/utils/hash.ts', ...] * console.log(results.totalMatches); // 45 * ``` */ export declare function searchByPath(input: SearchByPathInput, context: ToolContext): Promise; /** * MCP tool definition for search_by_path * * This tool provides glob pattern file search over the code index. * It does NOT require confirmation as it's a read-only operation. */ export declare const searchByPathTool: { name: string; description: string; inputSchema: { type: "object"; properties: { pattern: { type: string; description: string; }; limit: { type: string; description: string; default: number; minimum: number; maximum: number; }; }; required: string[]; }; requiresConfirmation: boolean; }; //# sourceMappingURL=searchByPath.d.ts.map