Skip to main content
Glama

Read a text file

read_file
Read-onlyIdempotent

Read text files from allowed directories such as home, shared storage, or Termux tmp, with line offsets and numbering; use base64 encoding for binary files.

Instructions

Read a file from an allowed directory (home, shared storage or Termux tmp) as text. Supports line offsets and line numbering. Binary files must be read with encoding="base64". Large reads are limited by security.maxReadBytes.

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute path or path relative to $HOME.
limitNoMaximum number of lines to return. Default 2000.
offsetNoFirst line to return (1-based). Default 1.
encodingNoBuffer encoding, e.g. utf8, latin1, base64. Default utf8.
with_line_numbersNoPrefix every line with its line number.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior3/5

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

Annotations already declare readOnlyHint/idempotentHint/destructiveHint=false, so the safety profile is covered. The description adds useful context beyond that: the directory allow-list, the security.maxReadBytes cap on large reads, and the binary/base64 requirement. What it omits is the actual consequence of hitting the cap (error vs. truncation) and the return shape.

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?

Four short sentences, front-loaded with the verb and scope, then the binary and size caveats. No filler or redundancy; each sentence carries an actionable constraint.

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 should describe the return value, and it doesn't — an agent cannot tell whether content comes back as one string, whether line numbers are embedded in the text, or how a too-large read is reported. The input side is fully covered, but for a read tool the missing return semantics are a material gap.

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

Parameters3/5

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

Schema description coverage is 100%, so every parameter is already documented in the schema. The description restates offsets and line numbering without adding format or edge-case detail (e.g. 1-based offsets, or interaction between limit and truncation). This is the baseline case where the schema carries the parameter burden.

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?

States a specific verb and resource ('Read a file ... as text') plus the scoping constraint (home, shared storage, Termux tmp). It is distinguishable from write_file/edit_file by the read framing, but it never explicitly contrasts with stat_path or list_dir, so sibling differentiation is implied rather than stated.

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?

Gives a concrete usage rule — binary files must be read via encoding="base64" — and a precondition that the path must be in an allowed directory. It does not say when to prefer stat_path/list_dir instead of reading content, so the exclusions are only partial.

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