Skip to main content
Glama

Read a file from the open Overleaf project

read_file
Read-only

Reads project-relative files by path, returning text or base64 content plus metadata; pass project_id to access a project without opening it first.

Instructions

Reads the contents of a file by project-relative path. Pass project_id to read without a prior open_project in this session. For text docs (.tex, .bib, .md, etc.) the full text appears in both the content array and structuredContent.text; metadata (version, line/byte counts, ranges, tracked-change/comment counts) is in structuredContent. For binary files (images, PDFs) base64 is in content and structuredContent.base64, with MIME type alongside.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "read_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoProject-relative path of the file, e.g. 'main.tex' or 'chapters/intro.tex'. If omitted, defaults to the project's root doc (visible as `root_doc_path` in `open_project`'s response).
project_idNoOverleaf project id from list_projects or open_project. Opens the project if it is not already active. Pass it on every call when MCP sessions may change between calls. Writes without it only go to the project last confirmed by open_project or by a write naming it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.4.0
    • addedInput schema / properties / project_id
      Added value: +{
      +  "description": "Overleaf project id from list_projects or open_project. Opens the project if it is not already active. Pass it on every call when MCP sessions may change between calls. Writes without it only go to the project last confirmed by open_project or by a write naming it.",
      +  "minLength": 8,
      +  "type": "string"
      +}
  2. First observedv0.3.5

TDQS

A4.3/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true; the description adds substantial behavioral context the annotation cannot: text is duplicated across content and structuredContent.text, metadata (version, line/byte counts, ranges, tracked-change/comment counts) lives in structuredContent, and binaries return base64 plus MIME type. It omits error behavior (e.g., missing path or inaccessible project), which keeps it from a 5.

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?

Three sentences, no filler: purpose and path scoping first, then the session/project_id rule, then the return-shape differences between text and binary files. Every sentence carries information an agent needs.

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?

There is no output schema, so the description must carry the return-value burden and does so thoroughly for both text and binary branches, including where metadata and MIME type appear. Combined with the 100%-covered input schema and the readOnly annotation, an agent has enough to call and interpret it correctly.

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 coverage is 100%, with both path and project_id already documented including the root-doc default and the session caveat. The description's project_id sentence largely restates what the schema says, so baseline 3 applies rather than added meaning.

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 the contents of a file') scoped to a project-relative path and tied to the open Overleaf project. An agent can distinguish it from siblings like read_comment_thread, read_log, and diff_file 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 Guidelines4/5

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

Gives clear conditional guidance for the key ambiguity: pass project_id to read without a prior open_project in the session. It does not explicitly contrast with diff_file/search_project or state when not to use it, so it falls short of full alternative routing.

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