Skip to main content
Glama

smart_read

Read files with automatic resolution per code block, matching query relevance to cut tokens while keeping key code. For precise needs, use full, diff, structure, or line ranges.

Instructions

Read a file at an automatic or caller-chosen resolution.

By default SRP selects the optimal resolution per code block from query relevance and token budget:

  • Blocks matching the query → FULL (complete source)

  • Related blocks → MEDIUM (signature + docstring)

  • Peripheral blocks → LOW (name only)

  • Irrelevant blocks → SKIP (omitted)

This reduces output by prioritizing query-relevant blocks. Use resolution="full" whenever exact source text is required.

Automatic selection is the right default and cannot be right for every question. Measured on this repository, a signature-level view answered 12/12 questions whose evidence lives in a signature and 0/20 whose evidence lives in a function body. Pass resolution when you already know which kind of question you are asking.

Args: file_path: Path to the file to read query: What you're looking for (improves relevance scoring) budget: Target token budget for the output (default: 1000) resolution: Choose "full", "medium", "diff", "structure", or "low"; empty means automatic. "full" returns the complete original text. "diff" requires previous_source and returns a whole-file unified diff. "structure" returns declarations, signatures, and imports while eliding implementation bodies when a useful native outline is available; otherwise it returns full source and reports structure_backend="full-fallback". Pinned output is not demoted to fit the budget; the response reports over_budget instead. previous_source: Required baseline when resolution is "diff". line_start: First line of an exact inclusive range (1-indexed). Must be supplied together with line_end and cannot be combined with resolution. line_end: Last line of an exact inclusive range (1-indexed). fresh: Bypass same-session re-read suppression and return the rendered output in full. read_scope: Optional caller scope for isolating parallel agents that intentionally share one MCP connection.

An exact repeated delivery returns only an opaque ~NNN handle. That handle means the rendered output is byte-identical to content already delivered in this MCP session. Pass fresh=true to expand it. Caller-selected FULL and line ranges return raw text on cache miss; they are not wrapped in JSON, so their text remains exact.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
freshNo
queryNo
budgetNo
line_endNo
file_pathYes
line_startNo
read_scopeNo
resolutionNo
previous_sourceNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations, the description fully carries behavioral disclosure. It details the automatic resolution tiers, token-budget handling, the `over_budget` reporting, `structure_backend="full-fallback"`, the opaque handle for repeated delivery, and the raw-text behavior of full/line-range reads. This leaves little ambiguity about tool behavior.

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?

Though lengthy, the description is tightly structured: a clear opening, grouped resolution behaviors, an evidence-based usage note, and a parameter list. Every sentence adds necessary information; no filler or repetition. This is appropriately sized for a 9-parameter tool.

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?

The description covers all important aspects for a complex read tool: default behavior, switchable modes, edge cases (diff fallback, over_budget), repeated-delivery handles, line-range constraints, and raw-text versus JSON wrapping. It is fully complete given the schema and absence of annotations.

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 description coverage is 0%, but the description compensates exhaustively. Every parameter is explained in an Args section, including interdependencies ('`previous_source` is required when resolution is "diff"', '`line_start`... cannot be combined with `resolution`') and semantic details like budget, fresh bypass, and read_scope isolation.

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 opens with a specific verb+resource statement: 'Read a file at an automatic or caller-chosen resolution.' It clearly explains the tool's core function and differentiates its resolution levels, going well beyond a mere restatement of the name.

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?

The description gives explicit usage guidance with measured evidence: 'Automatic selection is the right default and cannot be right for every question... Pass `resolution` when you already know which kind of question you are asking.' It also instructs to use `resolution="full"` for exact source text, and explains when line ranges and `fresh=true` are appropriate.

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/juyterman1000/entroly'

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