Skip to main content
Glama

read_file

Read remote file contents over SSH via SFTP, with sudo fallback for permission-restricted files.

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.

Args: host: Hostname, IP address, or SSH config alias remote_path: Path to the remote file username: SSH username (optional) password: SSH password (optional) key_filename: Path to SSH key file (optional) port: SSH port (optional) encoding: Text encoding (default: utf-8) errors: Error handling for decoding (default: replace) max_bytes: Maximum bytes to read (default: 2MB) sudo_password: Password for sudo (optional, not needed if NOPASSWD configured) use_sudo: Use sudo for reading (tries passwordless if no sudo_password provided)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYes
portNo
errorsNoreplace
encodingNoutf-8
passwordNo
use_sudoNo
usernameNo
max_bytesNo
remote_pathYes
key_filenameNo
sudo_passwordNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses that reading attempts SFTP first, falls back to 'sudo cat' under specific conditions, and mentions the max_bytes limit. This goes beyond a simple 'read file' and provides meaningful behavioral context. Missing details like error types or connection handling but adequate for a read tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with a clear one-sentence purpose, followed by an Args list that is necessary given 11 parameters. Each line earns its place, though the list is lengthy. It is structured and readable, not tautological.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool complexity (11 params, 0% schema coverage, no annotations), the description is quite complete. It covers all parameters, defaults, and the sudo fallback behavior. Since an output schema exists, return value documentation isn't required. It doesn't mention failure modes or timeouts, but overall it provides sufficient context for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description is the sole source of parameter clarity. The Args section explains each parameter, including host as 'Hostname, IP address, or SSH config alias', sudo_password behavior, max_bytes default (2MB), and encoding/errors. This adds significant meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Read a remote file over SSH' — a specific verb (read) plus a resource (remote file) that distinguishes it from siblings like write_file and execute_command. The fallback mechanism is also described, reinforcing the read-only purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context: use this tool to read remote files. It doesn't explicitly name alternatives or exclusions, but the purpose is obvious from the first line. The fallback logic is described, so the agent understands when sudo will be used. However, no explicit 'when-not' or alternative tool references are present.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DBeidachazi/mcp-ssh'

If you have feedback or need assistance with the MCP directory API, please join our Discord server