ftp_patch_file
Apply a unified diff patch to a remote file for bandwidth-efficient updates with atomic consistency. Supports backup creation and drift protection via hash verification.
Instructions
Apply a Unified Diff patch to a remote file. RECOMMENDED: Use this instead of ftp_put_contents for updating existing files to minimize bandwidth and ensure atomic-like updates. For new files, use ftp_put_contents.
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": {
"path": "<path>",
"patch": "<patch>"
},
"name": "ftp_patch_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Remote path to the existing file to be patched. | |
| patch | Yes | The Unified Diff formatted string containing your local changes. | |
| createBackup | No | Generate a .bak copy of the remote file before applying the changes. | |
| expectedHash | No | Optional (but recommended): The SHA-256 hash of the remote file before patching to prevent race conditions (drift protection). |