ssh_edit
Replace exact text in a remote file over SSH in one round trip, with batched edits and exact matching to ensure only intended changes are applied.
Instructions
Replace exact text in an existing remote file over SSH — the remote counterpart of the local file-editing tool. Each edit's 'old_str' must match exactly one location in the file (as it stands after any earlier edits in the same call); ambiguous or missing matches fail without writing anything. Provide multiple {old_str, new_str} entries in 'edits' to batch several changes to the same file into a single read-then-write round trip instead of one SSH round trip per edit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute (or login-directory-relative) remote path. Must already exist as a regular file. | |
| port | No | ||
| edits | Yes | One or more replacements, applied in order against the file's current remote content. | |
| target | Yes | OpenSSH target such as host, alias, or user@host. | |
| timeout | No | Local timeout in seconds. | |
| identity_file | No | ||
| extra_ssh_args | No | Additional ssh(1) flags passed verbatim, e.g. ["-J", "jumphost"]. Prefer the dedicated port, identity_file, and strict_host_key_checking parameters. | |
| known_hosts_file | No | ||
| strict_host_key_checking | No | Boolean or one of yes, no, ask, accept-new, off. |