Skip to main content
Glama

read

Reads a file with minimal tokens by caching its content and returning only diffs when changed. Provide a known hash to skip unchanged data.

Instructions

Read a file, returning as few tokens as possible. For 2+ files, use batch_read.

The first read returns the full numbered content plus a content_hash. A later read of an unchanged file returns "unchanged": true with no body (you already have it); a changed file returns a unified diff. Reading also caches the file so grep, search, and batch_read can see it.

Whenever you re-read a file you have read before, pass back known_hash (the content_hash from your last read of it). It is the server's only proof that you still hold the content, so use it every time you can; the server then skips re-sending unchanged bytes. Use offset/limit to read or recover an exact line range, for example after a large file was summarized. A binary file returns metadata instead of content; for images use read_image.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path (absolute, or relative to the project root). Use an absolute path for files outside the project root.
limitNoNumber of lines to return starting at `offset`.
offsetNo1-based first line for a ranged read; omit or pass 0 to start from the first line.
max_sizeNoByte threshold above which the file is semantically summarized; recover exact lines afterward with `offset`/`limit`.
known_hashNoThe `content_hash` from your last read of this file; pass it back to get `"unchanged"` instead of the content re-sent. Omit only on a first read or when you no longer hold the hash.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
hintNo
mimeNo
pathNo
sizeNo
linesNo
paramsNo
contentNo
is_diffNo
is_binaryNo
truncatedNo
unchangedNo
from_cacheNo
total_linesNo
content_hashNo
tokens_savedNo
total_tokensNo
tokens_originalNo
tokens_returnedNo
Behavior5/5

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

With no annotations, the description fully discloses behavior: caching on first read, returning 'unchanged' or a diff on subsequent reads, handling of binary files, and the effect of `max_size`. Side effects like caching are explicitly mentioned.

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?

The description is tightly written with no superfluous sentences. Core purpose is front-loaded, and each sentence adds distinct value, making it highly concise and well-structured.

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?

Given 5 parameters, no annotations, and an existing output schema, the description covers return behavior, caching, parameter usage, and alternatives comprehensively. An agent has all necessary context to use the tool 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%, baseline 3. The description adds significant value beyond schema: explains `known_hash` as server proof of content, `offset`/`limit` for exact line ranges, and `max_size` triggering summarization. This justifies a score of 4.

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?

The description clearly states 'Read a file, returning as few tokens as possible.' It distinguishes from sibling tools like `batch_read` and `read_image`, making the tool's specific purpose unambiguous.

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?

Explicit guidance is given: 'For 2+ files, use `batch_read`.' It explains when to use parameters like `known_hash`, `offset`/`limit`, and `max_size`, providing clear context for when to use this tool vs alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CoderDayton/semantic-cache-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server