Read File
read_fileRead a remote file over SSH, using SFTP first and falling back to sudo cat when permission is denied or sudo credentials are supplied.
Instructions
Read a remote file over SSH.
Attempts to read using SFTP first. If permission is denied and use_sudo is True or sudo_password is provided, falls back to using 'sudo cat' via shell command.
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": {
"host": "<host>",
"remote_path": "<remote_path>"
},
"name": "read_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | Yes | Hostname, IP address, or SSH config alias | |
| port | No | SSH port (optional) | |
| errors | No | Error handling for decoding (default: replace) | replace |
| encoding | No | Text encoding (default: utf-8) | utf-8 |
| password | No | SSH password (optional) | |
| use_sudo | No | Use sudo for reading (tries passwordless if no sudo_password provided) | |
| username | No | SSH username (optional) | |
| max_bytes | No | Maximum bytes to read (default: 2MB) | |
| remote_path | Yes | Path to the remote file | |
| key_filename | No | Path to SSH key file (optional) | |
| sudo_password | No | Password for sudo (optional, not needed if NOPASSWD configured) |