Skip to main content
Glama

read

Read files with automatic encoding detection and line numbers. Supports images, SVG, and flexible line range selection with offset/limit.

Instructions

Reads a file and returns its contents with line numbers. Encoding-aware: auto-detects file encoding (UTF-8, EUC-KR, Shift-JIS, etc.). Image files (PNG, JPG, GIF, BMP, WebP, TIFF, ICO) are returned as ImageContent (base64). SVG files are returned as text. Supports offset/limit for reading specific line ranges. Negative offset reads from end (e.g. offset=-5 reads last 5 lines). Offset accepts integer, string range "100-200", or [start, end] array. Accepts "path" as alias for "file_path". Relative paths are resolved against the server CWD (the directory from which agent-tool was launched).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathNoAbsolute or relative path to the file to read
pathNoAlias for file_path
offsetNoLine offset. Integer (1-based, negative=from end), string range 'start-end', or [start,end] array. Default: 0 (all)
limitNoMaximum number of lines to read. Default: 0 (all)
start_lineNoAlias for offset (1-based line number to start reading from)
end_lineNoEnd line number (1-based, inclusive). Sets limit = end_line - start_line + 1 when used with start_line
Behavior5/5

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

No annotations provided; the description fully discloses behavior: encoding auto-detection, image handling as ImageContent, SVG as text, multiple offset formats, negative offset for end lines, alias support, and relative path resolution against server CWD.

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?

The description is concise yet covers many details. A more structured grouping of features could improve readability, but it is not overly verbose for the amount of information provided.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema, but description explains image/SVG handling and line range parameters. Could benefit from specifying the return format for text files (e.g., JSON with lines and line numbers). Overall complete for a file-read tool.

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%, and the description adds significant meaning beyond schema by explaining offset formats (negative, range string, array), behavior of start_line/end_line alias pair, and path resolution. Only minor improvement would be to clarify return structure.

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 the tool reads a file and returns contents with line numbers. It distinguishes from siblings like multiread (multiple files) and listdir (directory listing) by specifying single file reading and various file types.

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?

Provides clear context on when to read files, with details on offset/limit, aliases, and path resolution. Does not explicitly state when not to use it, but the sibling list makes alternatives apparent.

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/knewstimek/agent-tool'

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