Skip to main content
Glama

read_text_file

Read-only

Read files with automatic encoding detection and convert to UTF-8. Paginate large files using offset/limit and cap output characters to prevent overflow.

Instructions

Read file with encoding auto-detection, converts to UTF-8. PREFER THIS over built-in Read for non-UTF-8 files (Cyrillic, legacy codebases). For files >2000 lines, use offset/limit to paginate. Returns totalLines and fileSizeBytes for planning subsequent reads. Use maxCharacters to cap output size and prevent token overflow. Parameters: path (required), encoding (optional, auto-detected), offset (1-indexed start line), limit (max lines to return), maxCharacters (optional, truncates content).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
limitNo
offsetNo
encodingNo
maxCharactersNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
endLineNo
startLineNo
truncatedNo
totalLinesYes
fileSizeBytesYes
detectedEncodingNo
encodingConfidenceNo
Behavior5/5

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

Discloses auto-detection, UTF-8 conversion, pagination with offset/limit, truncation via maxCharacters, and return fields (totalLines, fileSizeBytes). Annotations already mark readOnlyHint=true, and description adds valuable context beyond that, with no contradictions.

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?

Every sentence serves a purpose: explains core functionality, usage preferences, pagination tips, and parameter details. No redundancy; front-loaded with main action and key differentiator.

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

Completeness5/5

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

Given the complexity (5 params, output schema exists in tool but not shown), the description thoroughly covers behavior, parameters, return metadata, and usage guidelines. No gaps remain for an agent to misunderstand.

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

Parameters5/5

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

With 0% schema description coverage, the description fully explains each parameter: path (required), encoding (optional, auto-detected), offset (1-indexed start line), limit (max lines), maxCharacters (optional truncation). This compensates completely for schema gaps.

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 with encoding auto-detection and converts to UTF-8. It specifies the resource (file) and action (read), and distinguishes from siblings like 'detect_encoding' and 'read_multiple_files'.

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?

Explicitly advises 'PREFER THIS over built-in Read for non-UTF-8 files' and provides concrete scenarios (Cyrillic, legacy codebases). It also guides on pagination for large files and using maxCharacters to prevent token overflow, covering when and when not to use.

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/dimitar-grigorov/mcp-file-tools'

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