Skip to content
2 changes: 1 addition & 1 deletion docs/core/subagents.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ description: Specialized in finding security vulnerabilities in code.
kind: local
tools:
- read_file
- search_file_content
- grep_search
model: gemini-2.5-pro
temperature: 0.2
max_turns: 10
Expand Down
11 changes: 5 additions & 6 deletions docs/tools/file-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,13 @@ directories) will be created.
`Found 5 file(s) matching "*.ts" within src, sorted by modification time (newest first):\nsrc/file1.ts\nsrc/subdir/file2.ts...`
- **Confirmation:** No.

## 5. `search_file_content` (SearchText)
## 5. `grep_search` (SearchText)

`search_file_content` searches for a regular expression pattern within the
content of files in a specified directory. Can filter files by a glob pattern.
Returns the lines containing matches, along with their file paths and line
numbers.
`grep_search` searches for a regular expression pattern within the content of
files in a specified directory. Can filter files by a glob pattern. Returns the
lines containing matches, along with their file paths and line numbers.

- **Tool name:** `search_file_content`
- **Tool name:** `grep_search`
- **Display name:** SearchText
- **File:** `grep.ts`
- **Parameters:**
Expand Down
30 changes: 15 additions & 15 deletions packages/core/src/core/__snapshots__/prompts.test.ts.snap

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions packages/core/src/core/prompts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ApprovalMode } from '../policy/types.js';
vi.mock('../tools/ls', () => ({ LSTool: { Name: 'list_directory' } }));
vi.mock('../tools/edit', () => ({ EditTool: { Name: 'replace' } }));
vi.mock('../tools/glob', () => ({ GlobTool: { Name: 'glob' } }));
vi.mock('../tools/grep', () => ({ GrepTool: { Name: 'search_file_content' } }));
vi.mock('../tools/grep', () => ({ GrepTool: { Name: 'grep_search' } }));
vi.mock('../tools/read-file', () => ({ ReadFileTool: { Name: 'read_file' } }));
vi.mock('../tools/read-many-files', () => ({
ReadManyFilesTool: { Name: 'read_many_files' },
Expand Down Expand Up @@ -241,14 +241,14 @@ describe('Core System Prompt (prompts.ts)', () => {
);
expect(prompt).toContain(`do not ignore the output of the agent`);
expect(prompt).not.toContain(
"Use 'search_file_content' and 'glob' search tools extensively",
"Use 'grep_search' and 'glob' search tools extensively",
);
} else {
expect(prompt).not.toContain(
`your **first and primary action** must be to delegate to the '${CodebaseInvestigatorAgent.name}' agent`,
);
expect(prompt).toContain(
"Use 'search_file_content' and 'glob' search tools extensively",
"Use 'grep_search' and 'glob' search tools extensively",
);
}
expect(prompt).toMatchSnapshot();
Expand Down Expand Up @@ -291,7 +291,7 @@ describe('Core System Prompt (prompts.ts)', () => {
// Should NOT include disabled tools
expect(prompt).not.toContain('`google_web_search`');
expect(prompt).not.toContain('`list_directory`');
expect(prompt).not.toContain('`search_file_content`');
expect(prompt).not.toContain('`grep_search`');
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/policy/policies/plan.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ priority = 50
modes = ["plan"]

[[rule]]
toolName = "search_file_content"
toolName = "grep_search"
decision = "allow"
priority = 50
modes = ["plan"]
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/policy/policies/read-only.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ decision = "allow"
priority = 50

[[rule]]
toolName = "search_file_content"
toolName = "grep_search"
decision = "allow"
priority = 50

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tools/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
10 changes: 8 additions & 2 deletions packages/core/src/tools/grep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tools/ripGrep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/tools/tool-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -32,7 +32,7 @@ export const ASK_USER_DISPLAY_NAME = 'Ask User';
*/
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,
};

/**
Expand Down
Loading