Skip to main content
Glama

read_lines

Read-onlyIdempotent

Read an exact 1-indexed line range from a file when you have a line number, such as a traceback frame or grep hit, and identify the enclosing function or class.

Instructions

Read an exact line range from a file (1-indexed, inclusive). The tool to reach for when you hold a LINE NUMBER rather than a symbol name: a traceback frame, a grep -n hit, a compiler or linter error. Replaces sed -n '105,150p' file, head, tail and cat + scroll. Names the function/class holding the first line, so "which function is line N in" takes one call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endNoLast line, inclusive. Omit for start+59.
fileNoAlias de `file_path`. Path to an indexed file (relative to project root).
lineNoAlias de `start`. First line, 1-indexed, inclusive.
pathNoAlias de `file_path`. Path to an indexed file (relative to project root).
hintsNoAppend the enclosing symbol (default true).
startNoFirst line, 1-indexed, inclusive.
numbersNoPrefix each line with its number (default true).
projectNoProject name/path (default: active).
end_lineNoAlias de `end`. Last line, inclusive. Omit for start+59.
file_pathNoPath to an indexed file (relative to project root).
max_linesNoCap on returned lines (default 400, 0=uncapped).
start_lineNoAlias de `start`. First line, 1-indexed, inclusive.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.24.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already declare the full safety profile (readOnly, idempotent, non-destructive, closed-world), so the bar is low. The description adds genuine non-obvious behavior: it names the enclosing function/class for the first line, and calls out that 'which function is line N in' resolves in one call — context the annotations do not carry.

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?

Front-loads the core operation, then the selection condition, then the replacement mapping. Three dense sentences with zero filler; every clause carries selection or behavioral information.

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?

For a read-only, 12-param tool whose annotations cover safety and whose schema fully documents every parameter, the description closes the remaining gaps: when to choose it and what extra output (symbol naming) it yields. No output schema is needed since the return shape is described.

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 and the schema already documents the aliases, defaults (start+59, max_lines 400), and flag meanings. The description still adds meaning by explaining what the hints output actually produces (the enclosing symbol), which the terse 'Append the enclosing symbol' schema text only implies.

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 with precise scope: 'Read an exact line range from a file (1-indexed, inclusive).' It explicitly distinguishes itself from symbol-based siblings by naming the exact condition that selects it — holding a LINE NUMBER rather than a symbol name — so an agent can separate it from get_function_source or get_class_source without opening either schema.

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?

Gives concrete triggering situations (traceback frame, grep -n hit, compiler/linter error) and names the exact shell commands it replaces (sed -n, head, tail, cat + scroll). The contrast with symbol-name tools supplies the implicit when-not, 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.