Skip to main content
Glama

Read a file

read_file
Read-only

Read a project text file exactly as the editor shows it, optionally windowing large files by line range. Use it before editing so edit quotes match verbatim.

Instructions

Read a text file as the editor shows it right now (open documents are flushed first). Reads cap at ~100 KB — window larger files with from_line/to_line (1-based, inclusive; the result echoes the window it served, to_line clamped to the last line). Read before you edit: edit_file quotes must match this content verbatim. The result carries contentVersion (the branch version — pass it as base_version when you write this file) and fileVersion (the version at which this file itself last changed). Text is decided by content, not extension: a file with binary bytes is refused.

Input Schema

NameRequiredDescriptionDefault
pathYesFile path relative to the project root, e.g. "main.tex" or "sections/intro.tex" — no leading "/", no "..", and hidden folders (.git, .aldine-out) are off limits.
branchNoBranch name (defaults to 'main'). Every result, error results included, echoes {branch, head} — head is the branch's current commit (after a write, the commit that write made). Pass the branch explicitly whenever you are not on main.
projectNoProject id. Optional when the access token is scoped to exactly one project.
to_lineNo
from_lineNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint; the description adds substantial behavior beyond that: open documents are flushed first, reads cap at ~100 KB, to_line is clamped to the last line, the result echoes the window served, and files with binary bytes are refused based on content rather than extension.

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?

Dense but front-loaded: freshness/flush first, then size cap and windowing, then the edit dependency, then version fields, then binary refusal. Every sentence carries actionable information with no filler.

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?

With no output schema, the description explains the important return fields (contentVersion, fileVersion, the echoed window and branch/head context implied by the schema notes). It covers freshness, limits, pagination, failure mode for binaries, and the downstream edit_file dependency.

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 60% and from_line/to_line have no schema descriptions; the description compensates by defining them as 1-based, inclusive, and clamped in the echo. path, branch, and project semantics are already fully documented in the schema, so the description adds value only where the schema is thin.

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 ('Read a text file') and immediately defines the exact semantics it returns: the editor's current state with open documents flushed. It distinguishes itself from the write siblings by tying its output to edit_file quote matching.

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 explicit conditions: window files larger than ~100 KB with from_line/to_line, and read before editing so edit_file quotes match verbatim. It does not name a read alternative (none exists among siblings), so the guidance is clear context without an explicit when-not-to-use.

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