Perform exact string replacement in a file.
## Parameters
- `path` (required): Absolute path to the file
- `old_string` (required): The exact text to find and replace
- `new_string` (required): The replacement text
- `replace_all` (optional): Replace all occurrences (default: false)
## Usage Notes
- You MUST read the file first before editing
- The `old_string` must be unique in the file (or use `replace_all`)
- Preserve exact indentation from the file
- The edit will FAIL if `old_string` is not found or not unique
## Best Practices
- Include enough context in `old_string` to make it unique
- Preserve the exact whitespace and indentation
- Use `replace_all` for renaming variables/functions across the file
- Make targeted changes rather than large rewrites
## Example
```json
{
"path": "/path/to/file.rs",
"old_string": "fn old_name() {",
"new_string": "fn new_name() {"
}
```
Rename all occurrences:
```json
{
"path": "/path/to/file.rs",
"old_string": "old_var",
"new_string": "new_var",
"replace_all": true
}
```