1Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.
2
3<prerequisites>
41. Use View tool to understand file contents and context
52. Verify directory path is correct
6</prerequisites>
7
8<parameters>
91. file_path: Absolute path to file (required)
102. edits: Array of edit operations, each containing:
11 - old_string: Text to replace (must match exactly including whitespace/indentation)
12 - new_string: Replacement text
13 - replace_all: Replace all occurrences (optional, defaults to false)
14</parameters>
15
16<operation>
17- Edits applied sequentially in provided order
18- Each edit operates on result of previous edit
19- All edits must be valid for operation to succeed - if any fails, none applied
20- Ideal for several changes to different parts of same file
21</operation>
22
23<critical_requirements>
241. All edits follow same requirements as single Edit tool
252. Edits are atomic - either all succeed or none applied
263. Plan edits carefully to avoid conflicts between sequential operations
27</critical_requirements>
28
29<warnings>
30- Tool fails if old_string doesn't match file contents exactly (including whitespace)
31- Tool fails if old_string and new_string are identical
32- Earlier edits may affect text that later edits try to find - plan sequence carefully
33</warnings>
34
35<best_practices>
36- Ensure all edits result in correct, idiomatic code
37- Don't leave code in broken state
38- Use absolute file paths (starting with /)
39- Use replace_all for renaming variables across file
40- Avoid adding emojis unless user explicitly requests
41</best_practices>
42
43<new_file_creation>
44- Provide new file path (including directory if needed)
45- First edit: empty old_string, new file contents as new_string
46- Subsequent edits: normal edit operations on created content
47</new_file_creation>