Skip to main content
Glama

Read a project file

read_file
Read-only

Fetch a single Overleaf project text file after syncing latest commits; use line ranges to sample or revision modes to support guarded edits and deltas.

Instructions

Read one text file from the project after pulling the latest commits from Overleaf. Plain calls return the text, line-numbered when startLine or endLine is given; startLine alone reads to the end, and endLine is clamped to the file. mode=full returns JSON with the content and a revision hash for a guarded edit; mode=smart with previousRevision returns kind unchanged, a delta, or full content when this server process does not know that revision or a delta would be no smaller. Use a line range to sample a large file, mode=full before an edit that passes expectedRevision, and mode=smart to re-read a file already read. Apply a delta only to its exact baseline: split on newline, replace deleteLineCount lines at the 1-based startLine with change.lines, and join on newline. Plain text is cut off after 60,000 characters; in a revision mode, a file too large to return whole comes back truncated with no revision. Fails without reading for a missing or binary file, a path outside the project, a line range combined with mode, or startLine after endLine.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoReturn revision-aware JSON instead of plain text: "full" for whole content plus a revision, "smart" for a delta against previousRevision. Cannot be combined with startLine/endLine.
pathYesPath to the file relative to the project root, e.g. sections/intro.tex.
endLineNoLast line to return, inclusive. Cannot be combined with mode.
projectNoWhich project to use: its Overleaf address, its 24-character id, or a registered project name. Omit to use the default project.
startLineNoFirst line to return, 1-indexed. Cannot be combined with mode.
previousRevisionNoA 64-character revision hash this server returned for this same file earlier in this session. Requires mode=smart.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.8

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only cover the safety profile (readOnlyHint, openWorldHint); the description adds substantial behavioral context beyond them — the pre-read commit pull, the 60,000-character plain-text cutoff, truncation-without-revision in revision modes, and the exact failure conditions (missing/binary file, out-of-project path, mode+line-range conflict, startLine after endLine).

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?

It is a dense single block, but front-loaded with the core action and ordered sensibly (modes, then edit workflow, then truncation, then failures). The delta-application recipe is arguably reference material rather than selection guidance, which slightly dilutes conciseness.

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 and a complex multi-mode tool, the description carries the full burden and does so: return format (plain text vs revision JSON), revision/hash semantics, truncation behavior, and all documented failure paths. An agent has everything needed to call it correctly.

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 adds real semantics the schema omits: startLine alone reads to the end, endLine is clamped, and it documents the exact delta-application algorithm (split on newline, replace deleteLineCount lines at 1-based startLine, join). It stops short of documenting every parameter (e.g. project resolution), so not a full 5.

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 gives a precise verb+resource ("Read one text file from the project") and adds the distinguishing behavior that it pulls the latest Overleaf commits first. It is clear what the tool does, but it never explicitly contrasts itself with the closely related sibling read_section, so the agent must infer the boundary from the resource wording.

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?

It states explicit selection rules for each mode: "Use a line range to sample a large file, mode=full before an edit that passes expectedRevision, and mode=smart to re-read a file already read." Each variant is tied to a concrete situation, leaving nothing to inference.

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