/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { BaseDeclarativeTool, type ToolInvocation, type ToolResult } from './tools.js'; import { Config } from '../config/config.js'; import { MessageBus } from '../confirmation-bus/message-bus.js'; /** * Parameters for the GrepTool */ export interface GrepToolParams { /** * The regular expression pattern to search for in file contents */ pattern: string; /** * The directory to search in (optional, defaults to current directory relative to root) */ dir_path?: string; /** * Alternative parameter name for dir_path (for backward compatibility) */ path?: string; /** * File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}") */ include?: string; /** * Maximum number of total matches to return (optional) */ max_results?: number; /** * Maximum number of files to include in results (optional) */ max_files?: number; /** * Maximum number of matches per file to return (optional) */ max_per_file?: number; /** * Timeout in milliseconds (default: 60000ms = 1 minute, max: 300000ms = 5 minutes). * If the operation times out, an error is returned with suggestions to use a * longer timeout or a more specific pattern. */ timeout_ms?: number; } /** * Implementation of the Grep tool logic (moved from CLI) */ export declare class GrepTool extends BaseDeclarativeTool { private readonly config; static readonly Name = "search_file_content"; constructor(config: Config, _messageBus?: MessageBus); protected validateToolParamValues(params: GrepToolParams): string | null; protected createInvocation(params: GrepToolParams, _messageBus?: MessageBus): ToolInvocation; }