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
'A tool for search and replace contents of an existing file.\n\n'+
76
76
'## Overview\n'+
77
-
'This tool replaces sections of content in an existing file using oldStr/newStr blocks that define exact changes to specific parts of the file.\n\n'+
77
+
'This tool replaces sections of content in an existing file using `oldStr`/`newStr` blocks that define exact changes to specific parts of the file. You MUST ALWAYS bundle as many changes as you can by populating the diffs array with different `oldStr`/`newStr` pairs. You MUST ALWAYS read the contents of the file you want to update first before using the tool to ensure successful result.\n\n'+
78
78
'## When to use\n'+
79
79
'- When you need to make targeted changes to specific parts of a file\n'+
80
80
'- When you need to update multiple sections of the same file\n'+
81
81
'## When not to use\n'+
82
+
'- When `oldStr` and `newStr` are identical, as the tool will throw an error for no-op replacements\n'+
82
83
'- When you need to create a new file\n'+
83
84
'- When you need to rename or move a file\n\n'+
84
85
'## IMPORTANT Notes\n'+
85
-
'- Use this tool to delete code by using empty `newStr` parameter.\n'+
86
-
'- The `oldStr` parameter should match EXACTLY one or more consecutive lines from the original file. Be mindful of whitespaces! Include just the changing lines, and a few surrounding lines if needed for uniqueness. Do not include long runs of unchanging lines in `oldStr`.\n'+
87
-
'- The `newStr` parameter should contain the edited lines that should replace the `oldStr`.\n'+
88
-
'- When multiple edits to the same file are needed, populate the diffs array with `oldStr` and `newStr` pairs. This improves efficiency by reducing the number of tool calls and ensures the file remains in a consistent state.\n'+
89
-
'- Each `oldStr` must be unique within the file - if there are multiple matches, the operation will fail.',
86
+
'- You MUST ALWAYS read the contents of the file you want to update first before using the tool to ensure successful result\n'+
87
+
'- Use this tool to delete code by using empty `newStr` parameter\n'+
88
+
'- The `oldStr` parameter should match EXACTLY one or more consecutive lines from the original file. Be mindful of whitespaces! Include just the changing lines, and a few surrounding lines if needed for uniqueness. Do not include long runs of unchanging lines in `oldStr`\n'+
89
+
'- The `newStr` parameter should contain the edited lines that should replace the `oldStr`\n'+
90
+
'- When multiple edits to the same file are needed, ALWAYS populate the diffs array with `oldStr` and `newStr` pairs. This improves efficiency by reducing the number of tool calls and ensures the file remains in a consistent state',
90
91
inputSchema: {
91
92
type: 'object',
92
93
properties: {
@@ -96,7 +97,8 @@ export class FsReplace {
96
97
type: 'string',
97
98
},
98
99
diffs: {
99
-
description: 'List of diffs to replace contents in an existing file.',
100
+
description:
101
+
'List of diffs to replace contents in an existing file. For example, `[{"oldStr": "existingContent", "newStr": "newContent"}]`',
0 commit comments