Skip to main content
Glama

read_file

Reads a file from a given path and returns its contents as text, with optional offset and limit to retrieve specific line ranges.

Instructions

Read the contents of a file at the given path and return it as text. Supports reading specific line ranges.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "file_path": "<file_path>"
    },
    "name": "read_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoOptional maximum number of lines to read. Use with offset for paginated reading.
offsetNoOptional 1-based line number to start reading from. Use with limit for paginated reading.
file_pathYesThe absolute or relative path to the file to read. Accepts cross-drive paths like D:/path/to/file.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden; it does disclose the return format (text) and that line-range reads are supported, which is useful behavior beyond the schema. However, it omits what happens for missing files, binary content, encoding issues, very large files, or permission failures, which matters for a filesystem read.

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?

Two short sentences with the core action front-loaded and no filler; the line-range capability is appended as a secondary detail where it belongs. Nothing is redundant or padded.

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

Completeness3/5

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

For a simple three-parameter read tool with full schema coverage and no output schema, the definition covers the essentials. It stops short of error behavior, binary/large-file handling, and output truncation semantics, which an agent would want before relying on it.

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

Parameters3/5

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

Schema description coverage is 100%, so file_path, limit, and offset are already fully documented including the pagination pairing and cross-drive path support. The description's mention of 'specific line ranges' only restates what the schema covers, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Read the contents of a file') plus the return format ('as text'), so an agent knows exactly what it does. It is clearly distinguishable from search_codebase by name and semantics, though the description never explicitly contrasts the two.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: an agent infers 'use this to read a file at a path.' There is no statement of when to prefer this over search_codebase, no prerequisites (file must exist, path format), and no exclusions such as binary files.

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

Deploy Server

Other Tools