You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constEDIT_DESCRIPTION=`Performs exact string replacements in files.
4
+
5
+
Usage:
6
+
- You must use your \`Read\` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
7
+
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
8
+
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
9
+
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
10
+
- The edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`.
11
+
- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.`
12
+
13
+
constedit={
14
+
type: "function",
15
+
function: {
16
+
name: "edit",
17
+
description: EDIT_DESCRIPTION,
18
+
parameters: {
19
+
type: "object",
20
+
properties: {
21
+
file_path: {
22
+
type: "string",
23
+
description: "The path of the file to edit (relative to the working directory)",
24
+
},
25
+
old_string: {
26
+
type: "string",
27
+
description:
28
+
"The exact text to find in the file. Must match exactly, including all whitespace, indentation, and line endings.",
29
+
},
30
+
new_string: {
31
+
type: "string",
32
+
description:
33
+
"The replacement text that will replace old_string. Must include all necessary whitespace and indentation.",
34
+
},
35
+
replace_all: {
36
+
type: "boolean",
37
+
description:
38
+
"When true, replaces ALL occurrences of old_string in the file. When false (default), only replaces the first occurrence and errors if multiple matches exist.",
0 commit comments