ssh_upload
Uploads a local file to a remote host via SFTP with atomic writes, auto-creates directories, and returns SHA256 integrity hash.
Instructions
Upload a local file to the remote host via SFTP. Binary-safe; preserves arbitrary bytes unlike 'cat > file <<EOF' over ssh_exec.
Writes to <remote_path>.partial first, then renames atomically on success — a crashed upload never leaves a half-written file at the target path. Parent directories are auto-created (mkdir -p). If remote_path points at an existing directory, the local filename is appended (same as scp).
Size cap: max_bytes (default 100 MiB, hard ceiling 1 GiB). Returns a sha256 of the bytes actually transferred so the caller can verify integrity.
Optional mode (octal, e.g. 493 for 0o755) runs chmod on the remote after the transfer. A chmod failure is non-fatal — the bytes are already there; mode_set=null in the response means the chmod was skipped or rejected.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| local_path | Yes | Absolute or relative path to a local file. Resolved against the server's current working directory; using an absolute path avoids surprises. | |
| remote_path | Yes | Destination path on the remote host. Can be a full file path (overwritten atomically) or a directory (local filename appended). Intermediate directories are created automatically. | |
| host | No | Alias of the configured host, or a raw address. If omitted, the server's default host is used. | |
| mode | No | Optional POSIX mode bits (int), e.g. 0o755 or 493. Applied via chmod after the upload. Pass None to skip. | |
| max_bytes | No | Hard cap on the transfer size. Default 100 MiB, clamped to 1 GiB. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||