/** * File content retrieval tool implementation * * Implements the scampi_get_files MCP tool which: * 1. Validates the directory path * 2. Loads the cache to get file summaries * 3. Reads file contents from disk * 4. Returns file content with optional cached summaries */ /** * Options for the getFiles function */ export interface GetFilesOptions { /** Include cached summaries if available (default: true) */ includeSummary?: boolean; } /** * Content and metadata for a single file */ export interface FileContent { /** File path relative to the codebase root */ path: string; /** File content as a string */ content: string; /** Cached summary if available and requested */ summary?: string; /** Error message if file read failed */ error?: string; } /** * Result of the getFiles operation */ export interface GetFilesResult { /** Array of file contents with metadata */ files: FileContent[]; } /** * Error thrown when file retrieval fails due to configuration issues */ export declare class GetFilesError extends Error { readonly code: string; constructor(message: string, code: string); } /** * Retrieve file contents from a codebase * * This is the main implementation for the scampi_get_files MCP tool. * It performs the following steps: * * 1. Validate the directory path * 2. Load the cache to get file summaries (if requested) * 3. For each requested file: * - Validate the file path is within the project * - Read the file content from disk * - Get the cached summary if available * - Handle errors gracefully (include error field if read fails) * 4. Return array of file contents * * @param directory - Absolute path to the codebase directory * @param files - Array of relative file paths to retrieve * @param options - Optional configuration for file retrieval * @returns Promise resolving to GetFilesResult * @throws GetFilesError if directory validation fails * * @example * ```typescript * const result = await getFiles('/path/to/project', [ * 'src/index.ts', * 'src/utils.ts', * ]); * console.log(result.files.length); // 2 * ``` * * @example * ```typescript * // Without summaries * const result = await getFiles('/path/to/project', ['src/index.ts'], { * includeSummary: false, * }); * ``` */ export declare function getFiles(directory: string, files: string[], options?: GetFilesOptions): Promise; //# sourceMappingURL=get-files.d.ts.map