Skip to main content
Glama

Read File

read_file
Read-onlyIdempotent

Reads files by line range for text or as base64 for binary content, enabling inspection of remote files within a sandboxed filesystem.

Instructions

Read a file. Text is returned by line range; binary files can be returned as base64.

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": {
      "path": "<path>"
    },
    "name": "read_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesFile path, relative to the server root (or absolute inside it).
limitNoMax lines to return.
offsetNo1-based line to start from.
as_base64NoReturn raw bytes as base64 (for binary files: images, zips, pdf...).
line_numbersNoPrefix each line with its number (handy before edit_file).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is settled. The description adds genuine behavioral context beyond that: output mode depends on file type (line ranges for text, base64 for binary). It omits edge behavior such as truncation past the default 2000-line limit or errors for missing or out-of-range paths.

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?

Two short sentences, front-loaded with purpose and immediately followed by the output-mode distinction. No filler or redundant restatement of the tool name.

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?

An output schema exists and the input schema is fully documented, so return-value explanation is unnecessary. What remains thin is sibling routing and boundary behavior, which keeps this just below complete.

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 every parameter including limit, offset, as_base64 and line_numbers is already documented in the schema. The description only restates the two-mode split at a high level; baseline 3 applies when the schema carries the detail.

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?

"Read a file" names a specific verb and resource, and the second sentence clarifies the two return modes (line-range text vs base64 bytes). It does not, however, distinguish this tool from siblings such as read_many_files or get_file_info, leaving the agent to infer the boundary.

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

Usage Guidelines2/5

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

There is no explicit when-to-use guidance, no exclusion of alternatives, and no routing to read_many_files for multi-file reads or get_file_info for metadata-only needs. Usage context is only implied by the verb itself.

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