Skip to main content
Glama
TMYTiMidlY

portal-mcp-server

by TMYTiMidlY

remote_read

Read a file or 1-based line range from a remote host, returning paginated content plus SHA-256 hashes required for safe, conflict-checked edits.

Instructions

Read a file (or a 1-based line range) from a remote host with SHA-256 hashes.

Returns JSON with: content, file_hash, range_hash, start, end, total_lines, truncated. The file_hash MUST be supplied to remote_patch; if the file changed in between, remote_patch will refuse to overwrite.

The read is paged so a large file never has to come back as one oversized blob: a single call returns at most limit lines (default PORTAL_READ_MAX_LINES=2000) and at most PORTAL_READ_MAX_BYTES (default 16384) of content, whichever binds first — but always at least one line. When the page stops before the requested end, truncated is true and next_start gives the line to continue from (pass it back as start). Pages are cut on line boundaries, so range_hash stays valid for patching.

Usage: * Whole file (auto-paged): call remote_read(host, path); if the result has truncated: true, call again with start=<next_start> and repeat until truncated is false, concatenating each page's content in order. * A specific range: remote_read(host, path, start=40, end=80) (still paged if that range is huge). * Just the first N lines: remote_read(host, path, limit=N) — handy to peek the head of a big file without pulling it all.

Args: host: SSH host alias (from ~/.ssh/config) or registered host name path: Absolute remote path start: 1-based starting line (default 1) end: 1-based ending line of the requested range, inclusive (default: end of file) limit: max number of lines to return in this page (default: the PORTAL_READ_MAX_LINES cap). The byte cap may shorten the page further. encoding: Text encoding (default utf-8) use_sudo: read via sudo cat (root) for a file the SSH user can't read (root-owned / mode 600). The sudo password is resolved out-of-band per host (never a parameter) and the result is flagged high_risk. Exact bytes are preserved (no newline stripping) so file_hash stays valid for remote_patch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endNo
hostYes
pathYes
limitNo
startNo
encodingNoutf-8
use_sudoNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.0.3

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses paging caps (PORTAL_READ_MAX_LINES/BYTES), truncation and next_start continuation semantics, line-boundary cutting that keeps range_hash patch-valid, and sudo behavior including out-of-band password resolution and a high_risk flag. This is unusually rich behavioral context.

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?

Front-loaded with the return shape and patch dependency, then organized under Usage and Args headings. Dense and mostly waste-free, though the Usage bullets slightly restate the paging mechanics already described above.

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

Completeness5/5

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

An output schema exists, yet the description still names the return fields and explains how to consume them (paging loop, hash handoff to remote_patch). For a 7-param paged read tool, nothing needed for correct invocation is missing.

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 coverage is 0%, so the description must compensate, and it does: every one of the 7 params is documented with meaning and defaults, including the 1-based inclusivity of start/end, the interaction between limit and the byte cap, and that use_sudo is never a password parameter.

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?

States a specific verb+resource (read a file or 1-based line range from a remote host) with the added value of SHA-256 hashes. It is clearly distinguishable from siblings like remote_patch, remote_grep, and remote_transfer.

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

Usage Guidelines5/5

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

Explicitly enumerates three usage patterns (whole-file auto-paged, specific range, first-N-lines) with concrete syntax, and ties the returned file_hash to the downstream remote_patch requirement. When-and-how guidance is unambiguous.

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