Skip to main content
Glama

read_text_file

Read-only

Read files with auto-detected encoding, converting to UTF-8. Ideal for non-UTF-8 files (Cyrillic, legacy codebases). Returns line count and file size for paging large files.

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). Returns totalLines and fileSizeBytes for planning the next read. Parameters: path, encoding (auto-detected), offset (1-indexed start line), limit (max lines), maxCharacters (caps output to avoid token overflow), lineNumbers (default false: prefix lines with "N", absolute numbers — use to locate lines reported by grep or encoding errors; STRIP the prefix before using text as edit_file oldText). Page files >2000 lines: {"path": "D:\src\app.pas", "offset": 1, "limit": 2000}, then offset 2001, until offset exceeds totalLines.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
limitNo
offsetNo
encodingNo
lineNumbersNo
maxCharactersNo

Output Schema

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

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

Beyond the readOnlyHint annotation, the description discloses encoding auto-detection, UTF-8 conversion, return metadata (totalLines, fileSizeBytes), line number prefix behavior with a caution to strip it before use in edit_file, and maxCharacters to prevent token overflow. It also details offset as 1-indexed and limit as max lines, adding substantial behavioral context.

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 dense but efficient, with each sentence adding value. The parameter explanation is packed into one long but factually complete sentence; however, bullet points would improve scannability. The pagination example is a useful addition that justifies its length.

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?

The description covers the tool's purpose, usage guidance, parameter semantics, and return metadata, and even includes a concrete paging example. Since an output schema exists, detailed return structure is unnecessary. For a tool with 6 parameters, this description is remarkably complete.

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 compensates by explaining every parameter: path is implicit, encoding auto-detected, offset as 1-indexed start line, limit as max lines, maxCharacters to avoid token overflow, and lineNumbers with default false and prefix format. It also provides a pagination example demonstrating offset/limit usage, making parameter semantics clear.

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, using a specific verb and resource. It also distinguishes itself from the built-in Read tool by specifically targeting non-UTF-8 files, making its purpose unique among siblings.

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?

The description explicitly says 'PREFER THIS over built-in Read for non-UTF-8 files (Cyrillic, legacy codebases)', giving clear when-to-use guidance and naming an alternative. It also provides concrete pagination instructions for files larger than 2000 lines, showing exactly how to structure offset and limit for subsequent reads.

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