Skip to main content
Glama

read

Read a file with automatic caching. Returns full content on first read, indicates unchanged content, or provides a diff for modifications.

Instructions

Read a file. Automatically returns the most token-efficient response.

Use this for a single file. For 2+ files, prefer batch_read.

Behavior (automatic — no configuration needed):

  • First read: returns full content and seeds the cache.

  • Unchanged re-read: returns "unchanged": true (content already in context).

  • Modified re-read: returns a unified diff of changes.

  • External changes: detected automatically via mtime + content hash.

If response contains "unchanged": true, do NOT re-read — you already have the full content from a prior read. Use offset/limit to recover specific line ranges after truncation or context loss.

Args: path: File path (absolute or relative to project root). Use absolute paths for files outside the current project root. max_size: Maximum content size to return before summarization. offset: 1-based starting line number for targeted reads. limit: Number of lines to return from offset.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
max_sizeNo
offsetNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
truncatedNo
pathNo
contentNo
linesNo
unchangedNo
is_diffNo
semantic_matchNo
total_tokensNo
hintNo
from_cacheNo
tokens_savedNo
tokens_originalNo
tokens_returnedNo
paramsNo
Behavior5/5

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

No annotations exist, so description fully discloses caching, diff-based re-reads, automatic external change detection via mtime+hash, and recovery strategies. Highly transparent.

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?

Well-organized with section headers, but slightly verbose. Could trim some phrasing while retaining all information. Still efficient for the richness.

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?

Covers all necessary aspects: usage, behavior, parameters, and response handling. Output schema exists, so return values are covered. Complete for a file-read tool with caching logic.

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

Parameters5/5

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

Schema has 0% description coverage, but description compensates thoroughly: explains path absoluteness, max_size role, and offset/limit as line-range controls (1-based). Adds meaning beyond raw schema.

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?

Description clearly states 'Read a file' and emphasizes token efficiency. It explicitly distinguishes from sibling `batch_read` for multiple files, making the purpose unmistakable.

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?

Directs to use for single files and recommends `batch_read` for 2+. Also provides conditional guidance for re-reading behavior and handling of 'unchanged' responses, covering when to use offset/limit.

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