feat(core): rename search_file_content tool to grep_search and add legacy alias (#18003)

This commit is contained in:
Sandy Tao
2026-02-02 20:18:24 -08:00
committed by GitHub
parent ed26ea49e9
commit 5b254c379c
10 changed files with 39 additions and 34 deletions
+1 -1
View File
@@ -3,5 +3,5 @@
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export const DEFAULT_TOTAL_MAX_MATCHES = 20000;
export const DEFAULT_TOTAL_MAX_MATCHES = 100;
export const DEFAULT_SEARCH_TIMEOUT_MS = 30000;
+8 -2
View File
@@ -263,7 +263,13 @@ class GrepToolInvocation extends BaseToolInvocation<
const matchCount = allMatches.length;
const matchTerm = matchCount === 1 ? 'match' : 'matches';
let llmContent = `Found ${matchCount} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${this.params.include ? ` (filter: "${this.params.include}")` : ''}${wasTruncated ? ` (results limited to ${totalMaxMatches} matches for performance)` : ''}:\n---\n`;
let llmContent = `Found ${matchCount} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${this.params.include ? ` (filter: "${this.params.include}")` : ''}`;
if (wasTruncated) {
llmContent += ` (results limited to ${totalMaxMatches} matches for performance)`;
}
llmContent += `:\n---\n`;
for (const filePath in matchesByFile) {
llmContent += `File: ${filePath}
@@ -570,7 +576,7 @@ export class GrepTool extends BaseDeclarativeTool<GrepToolParams, ToolResult> {
super(
GrepTool.Name,
'SearchText',
'Searches for a regular expression pattern within the content of files in a specified directory (or current working directory). Can filter files by a glob pattern. Returns the lines containing matches, along with their file paths and line numbers.',
'Searches for a regular expression pattern within file contents. Max 100 matches.',
Kind.Search,
{
properties: {
+1 -1
View File
@@ -495,7 +495,7 @@ export class RipGrepTool extends BaseDeclarativeTool<
super(
RipGrepTool.Name,
'SearchText',
'FAST, optimized search powered by `ripgrep`. PREFERRED over standard `run_shell_command("grep ...")` due to better performance and automatic output limiting (max 20k matches).',
'Searches for a regular expression pattern within file contents. Max 100 matches.',
Kind.Search,
{
properties: {
+2 -2
View File
@@ -15,7 +15,7 @@ export const WEB_SEARCH_TOOL_NAME = 'google_web_search';
export const WEB_FETCH_TOOL_NAME = 'web_fetch';
export const EDIT_TOOL_NAME = 'replace';
export const SHELL_TOOL_NAME = 'run_shell_command';
export const GREP_TOOL_NAME = 'search_file_content';
export const GREP_TOOL_NAME = 'grep_search';
export const READ_MANY_FILES_TOOL_NAME = 'read_many_files';
export const READ_FILE_TOOL_NAME = 'read_file';
export const LS_TOOL_NAME = 'list_directory';
@@ -33,7 +33,7 @@ export const EXIT_PLAN_MODE_TOOL_NAME = 'exit_plan_mode';
*/
export const TOOL_LEGACY_ALIASES: Record<string, string> = {
// Add future renames here, e.g.:
// 'search_file_content': GREP_TOOL_NAME,
search_file_content: GREP_TOOL_NAME,
};
/**