Skip to main content
Glama

Read Text File

read_text_file
Read-only

Read a file's contents as text, optionally returning only the first or last N lines to limit output size.

Instructions

Read the complete contents of a file from the file system as text. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Use the 'head' parameter to read only the first N lines of a file, or the 'tail' parameter to read only the last N lines of a file. Operates on the file as text regardless of extension. Only works within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
headNoIf provided, returns only the first N lines of the file
pathYes
tailNoIf provided, returns only the last N lines of the file

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.0.1

TDQS

A4.3/5.0
Behavior4/5

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

The annotations already indicate readOnlyHint and openWorldHint. The description adds context about error messages and the restriction to allowed directories, which goes beyond the annotations and clarifies expected behavior.

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 information-dense without being verbose. It front-loads the core purpose and then explains the head/tail options and constraints. All sentences contribute meaningful details, though a slight redundancy exists in repeating the purpose at the start.

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?

The description covers when to use the tool, what it does, and its constraints (allowed directories, encoding handling). Since an output schema is present (as indicated), the absence of return-format details is acceptable. Overall, an agent has sufficient context to call this tool correctly.

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?

The schema covers head and tail descriptions (67% coverage). The description explicitly explains the head and tail parameters and their partial-read behavior. The path parameter is not described in the schema, but its role is implied by the tool's purpose and the 'single file' wording, so the description compensates adequately.

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 action (read), the resource (file), and the scope (complete contents as text). It distinguishes itself from siblings like read_media_file and read_multiple_files by explicitly mentioning 'as text' and 'single file', so an agent can select it appropriately.

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?

It explicitly states when to use the tool ('when you need to examine the contents of a single file') and explains head/tail for partial reads. It does not explicitly state when not to use it, but the sibling names and the 'single file' and 'as text' qualifiers provide implicit alternatives.

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

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/TimurRakhmatullin86/mcp-drill'

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