Skip to main content
Glama

Read File

read_file

Read 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

NameRequiredDescriptionDefault
hostYesHostname, IP address, or SSH config alias
portNoSSH port (optional)
errorsNoError handling for decoding (default: replace)replace
encodingNoText encoding (default: utf-8)utf-8
passwordNoSSH password (optional)
use_sudoNoUse sudo for reading (tries passwordless if no sudo_password provided)
usernameNoSSH username (optional)
max_bytesNoMaximum bytes to read (default: 2MB)
remote_pathYesPath to the remote file
key_filenameNoPath to SSH key file (optional)
sudo_passwordNoPassword for sudo (optional, not needed if NOPASSWD configured)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.2+p1

TDQS

B3.4/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden, and it does disclose one important trait: SFTP is tried first and 'sudo cat' is a fallback. Beyond that it says nothing about truncation at max_bytes (silently clipping long files), what happens on a missing file, whether output is decoded text, or that the operation is read-only and safe to repeat. For an 11-parameter SSH tool with zero annotation coverage, that is a thin behavioral profile.

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

Conciseness5/5

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

Three short sentences, zero filler, and the core mechanism is front-loaded before the conditional fallback. Every sentence carries information the agent could act on.

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

Completeness3/5

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

There is no output schema, so the description must convey what comes back, and it never says the result is decoded file text nor that max_bytes silently truncates content (only the schema default hints at it). Error behavior for unreadable or missing paths is also unstated, which matters for a tool with 11 parameters and an auth/sudo surface.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description genuinely adds meaning beyond the schema by explaining the precedence between SFTP and sudo and the exact condition that activates the sudo path, which the schema field text only hints at. It still leaves host/port/credential parameters entirely to the schema, which is acceptable given full coverage.

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

Purpose4/5

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

The description opens with a specific verb and resource ("Read a remote file over SSH"), which cleanly separates it from the write-side sibling write_file and from command-execution siblings. It never names an alternative explicitly, so it stops short of a 5.

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

Usage Guidelines3/5

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

Usage is implied by the stated mechanism, and the fallback condition (permission denied plus use_sudo or sudo_password) tells the agent how sudo gets triggered in practice. There is no explicit guidance on when to prefer this tool over execute_command for remote inspection, and no stated exclusions or prerequisites.

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