apps/docs/docs/advanced-usage/available-tools/edit.md
The edit tool performs search-and-replace operations on files, replacing either the first occurrence (default) or all occurrences when explicitly specified. It provides flexible control over replacement scope.
The tool accepts these parameters:
file_path (required): The path of the file to modify relative to the current working directory.old_string (required): The exact text to search for and replace.new_string (required): The text to replace occurrences with.replace_all (optional): Boolean flag. When true, replaces all occurrences. When false or omitted, replaces only the first occurrence.This tool searches for an exact string in a file and replaces either the first occurrence or all occurrences based on the replace_all parameter. By default, it replaces only the first match, making it suitable for targeted single-instance changes.
replace_all: truereplace_all parameter for global replacementapply_diff for complex editsWhen the edit tool is invoked, it follows this process:
file_path, old_string, and new_string parameters.old_string in the file.replace_all is false or omitted: replaces only the first occurrencereplace_all is true: replaces all occurrencesedit: Replaces first occurrence by default (this tool)edit_file: Always replaces all occurrencessearch_replace: Always replaces all occurrencesapply_diff: Use for precise, context-aware edits with fuzzy matching:::info Deprecated Alias
SearchAndReplaceTool is a deprecated internal alias for EditTool. They are the same tool.
:::