Skip to main content
Glama

files/read

Read-onlyIdempotent

Read a text file by absolute path and return raw contents; use line or byte ranges to page large files and avoid truncation.

Instructions

Reads a text file and returns its contents as raw text (no line numbers or metadata). Read-only; path must be absolute. To find a file use files/find, for size or mode files/list, to check whether it is binary files/filetype (binary files are refused with cannot read binary file). Selection: start_line/end_line (1-indexed, inclusive; start_line alone reads to the end, end_line alone starts at line 1) take precedence over the byte range offset/limit. With no selection, or offset without limit, at most 10240 bytes come back followed by a [WARNING: File truncated ...] line, so page large files with start_line/end_line or pass limit. There is no streaming: one call reads into memory, and a line over 64 KiB fails line mode. A start_line past the end is an error; an empty file returns an empty string. privileged: true (needs a grant, and a paths: entry for root) reads files your account cannot.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path of the file to read
limitNoNumber of bytes to return (no upper cap). With no selection at all, the first 10240 bytes are returned
offsetNoByte offset to start at; ignored when start_line/end_line is given. Without limit at most 10240 bytes are returned
end_lineNoLast line to return (inclusive); alone it starts at line 1. Ignored if below start_line
privilegedNoRun as root. Needs a grant for this tool in mcp-sudo.yaml and a `paths:` entry covering the path, otherwise refused
start_lineNoFirst line to return (1-indexed). With or without end_line it takes precedence over offset/limit; alone it reads to the end of the file

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.4.1
    • changedInput schema / properties / end_line / description
      Previous value: -"Ending line number (inclusive)."New value: +"Last line to return (inclusive); alone it starts at line 1. Ignored if below start_line"
    • changedInput schema / properties / limit / description
      Previous value: -"Number of bytes to read."New value: +"Number of bytes to return (no upper cap). With no selection at all, the first 10240 bytes are returned"
    • changedInput schema / properties / offset / description
      Previous value: -"Starting byte offset."New value: +"Byte offset to start at; ignored when start_line/end_line is given. Without limit at most 10240 bytes are returned"
    • changedInput schema / properties / path / description
      Previous value: -"Path to the file to read"New value: +"Absolute path of the file to read"
    • changedInput schema / properties / privileged / description
      Previous value: -"Set to true to read as root"New value: +"Run as root. Needs a grant for this tool in mcp-sudo.yaml and a `paths:` entry covering the path, otherwise refused"
    • changedInput schema / properties / start_line / description
      Previous value: -"Starting line number (1-indexed). Takes precedence over byte offsets."New value: +"First line to return (1-indexed). With or without end_line it takes precedence over offset/limit; alone it reads to the end of the file"
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, but the description adds substantial behavior beyond them: the 10240-byte truncation with a `[WARNING: File truncated ...]` line, no streaming (one call reads into memory), line-mode failure for lines over 64 KiB, error on start_line past end, empty string for empty files, and the grant/paths requirement for privileged. This is rich, non-obvious disclosure.

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?

Dense but front-loaded: reads as raw text, read-only, absolute path first, then routing, then selection semantics, then edge cases. Every sentence carries information, though the prose is packed tightly enough that it borders on overloading a single paragraph.

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?

For a read tool with no output schema, the description covers return format, truncation, error conditions, and privilege requirements completely. Nothing an agent needs to invoke it correctly is missing.

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 meaningfully adds precedence rules not fully captured by the schema: start_line/end_line take precedence over offset/limit, start_line alone reads to end, end_line alone starts at line 1, and offset without limit caps at 10240 bytes. Useful cross-parameter semantics, though most individual param meaning is already in the 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?

States a specific verb and resource ('Reads a text file and returns its contents as raw text') and explicitly scopes the return format ('no line numbers or metadata'). It also names three siblings (files/find, files/list, files/filetype), so an agent can distinguish it without opening any schema.

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?

Gives explicit routing to alternatives: 'To find a file use files/find, for size or mode files/list, to check whether it is binary files/filetype'. This is when-to-use-this-vs-others guidance with concrete alternatives, not just implied context.

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