Problem
Currently, file_write requires providing the full file content, which is cumbersome for surgical edits.
Proposed Solution
Add a patch action to file_write that supports:
Action: "patch"
Path: file to modify
OldString: text to find
NewString: replacement text
ReplaceAll: boolean (optional, default false)
Benefits
- Cleaner for small edits without full file reads
- Safer (less chance of accidentally overwriting unrelated sections)
- Aligns with user workflow preferences
Implementation Notes
- Should support both single-replace and multi-replace modes
- Consider adding
OldText / NewText as alternative parameter names for consistency with other tools
Problem
Currently,
file_writerequires providing the full file content, which is cumbersome for surgical edits.Proposed Solution
Add a
patchaction tofile_writethat supports:Action: "patch"Path: file to modifyOldString: text to findNewString: replacement textReplaceAll: boolean(optional, default false)Benefits
Implementation Notes
OldText/NewTextas alternative parameter names for consistency with other tools