Skip to main content
Glama

read_text_file

Retrieve and display the contents of a text file from the file system. Specify a file path to read it in full or use 'head' or 'tail' parameters to extract specific lines. Supports various text encodings and provides clear error messages if the file cannot be accessed.

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
Behavior4/5

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

With no annotations provided, the description carries full burden and does well: it discloses error handling ('provides detailed error messages'), encoding support ('Handles various text encodings'), and operational constraints ('Only works within allowed directories'). It doesn't mention performance characteristics like rate limits or file size limits, but covers core behavioral aspects adequately.

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?

The description is efficiently structured: first sentence states core purpose, second adds behavioral context, third provides usage guidance, fourth explains parameter usage, and fifth states constraints. Every sentence adds value with zero redundancy, and key information is front-loaded.

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?

For a read operation with 3 parameters and no output schema, the description is quite complete: it covers purpose, usage, parameters, constraints, and error behavior. The main gap is lack of output format details (what the returned text looks like, encoding specifics), but given it's a text read tool, this is partially mitigated by the clear purpose statement.

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 description coverage is 67% (2 of 3 parameters have descriptions). The description adds significant value: it explains the purpose of 'head' and 'tail' parameters ('read only the first N lines'/'read only the last N lines'), which the schema descriptions only partially cover. However, it doesn't explain the 'path' parameter beyond what's implied, leaving some semantic gap.

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 specific action ('Read the complete contents'), resource ('a file from the file system'), and scope ('as text'). It distinguishes from siblings like 'read_file' (which might handle binary) and 'read_multiple_files' (which handles multiple files) by specifying text-only, single-file operation.

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?

Explicit guidance is provided: 'Use this tool when you need to examine the contents of a single file.' It also distinguishes from alternatives by mentioning 'head' and 'tail' parameters for partial reading, and clarifies scope with 'Only works within allowed directories' (contrasting with unrestricted file access tools).

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

Related 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/Nexus-Digital-Automations/mcp-filesystem-updated'

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