Surgical Edit Remote File
ssh_editApply exact-match text replacements atomically to remote files over SSH, preserving permissions and line endings. Preview changes with a dry-run diff or guard against conflicts using a SHA-256 lock.
Instructions
Apply one or more exact-match text replacements atomically on a remote file, preserving original permissions and CRLF/LF line endings. Supports expected_sha256 optimistic concurrency lock and dry_run diff preview.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"target": "<target>",
"path": "<path>",
"edits": "<edits>"
},
"name": "ssh_edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Explicit remote absolute path (e.g. /etc/nginx/nginx.conf or C:\Services\app.json) or home-relative ~/... path. Bare relative paths are rejected. | |
| edits | Yes | Ordered list of exact-match edits; all must succeed or nothing is written | |
| target | Yes | SSH target as configured host alias, host, user@host, user@host:port, or [ipv6]:port. Never include remote paths in target. | |
| dry_run | No | Preview unified diff without writing to disk (default: false) | |
| expected_sha256 | No | Optional SHA-256 from ssh_read; aborts with CONFLICT if file changed on server |