replace_in_file
Replace an exact text snippet in a file only after verifying the expected SHA-256 and match count, then confirm the edit succeeded.
Instructions
Replace an exact text snippet only when the file SHA-256 and match count are exactly as expected, then verify the result. Prefer for small edits to existing files; requires WISP_ALLOW_FILE_WRITES.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| new | Yes | Replacement text. | |
| old | Yes | Exact existing text to replace. | |
| path | Yes | Path in the selected server filesystem, starting from its root. | |
| server_id | No | Wisp server ID. Omit to use the configured WISP_SERVER_ID default. | |
| expected_count | No | Exact number of old-text matches required before editing. | |
| expected_sha256 | Yes | 64-character SHA-256 from the most recent read or fingerprint of the same file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||