From 41db2cad4312378ff9d87e52e177772108ad7727 Mon Sep 17 00:00:00 2001 From: Hannes Rudolph Date: Wed, 23 Apr 2025 15:42:59 -0600 Subject: [PATCH] Update search_and_replace tool description for clarity and detail (#2891) --- .../__snapshots__/system.test.ts.snap | 22 +++++++++---------- src/core/prompts/tools/search-and-replace.ts | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap index 3ddf52858d..6e736931e9 100644 --- a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap +++ b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap @@ -210,7 +210,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -677,7 +677,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -1144,7 +1144,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -1611,7 +1611,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -2134,7 +2134,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -2669,7 +2669,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -3282,7 +3282,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -3749,7 +3749,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -4258,7 +4258,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -4802,7 +4802,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) @@ -5635,7 +5635,7 @@ Example for appending to the end of file: ## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory /test/path) diff --git a/src/core/prompts/tools/search-and-replace.ts b/src/core/prompts/tools/search-and-replace.ts index 9b068a6279..357a705832 100644 --- a/src/core/prompts/tools/search-and-replace.ts +++ b/src/core/prompts/tools/search-and-replace.ts @@ -2,7 +2,7 @@ import { ToolArgs } from "./types" export function getSearchAndReplaceDescription(args: ToolArgs): string { return `## search_and_replace -Description: Request to perform a search and replace operation on a file. Supports both literal text and regex patterns. Shows a diff preview before applying changes. +Description: Use this tool to find and replace specific text strings or patterns (using regex) within a file. It's suitable for targeted replacements across multiple locations within the file. Supports literal text and regex patterns, case sensitivity options, and optional line ranges. Shows a diff preview before applying changes. Required Parameters: - path: The path of the file to modify (relative to the current workspace directory ${args.cwd.toPosix()})