update_file
Find and replace text inside a file by providing the exact old and new strings, with control over replacing all occurrences or just the first.
Instructions
Find and replace text inside a file.
Use this when the user asks to change, replace, or update specific text within an existing file (e.g. "change X to Y in report.txt").
Args: path: Path to the file to modify. old_text: The exact existing text to search for. new_text: The text to replace it with. replace_all: If True (default), replace every occurrence. If False, replace only the first occurrence.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| new_text | Yes | ||
| old_text | Yes | ||
| replace_all | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |