read_text_file
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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| limit | No | ||
| offset | No | ||
| encoding | No | ||
| maxCharacters | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| endLine | No | ||
| startLine | No | ||
| truncated | No | ||
| totalLines | Yes | ||
| fileSizeBytes | Yes | ||
| detectedEncoding | No | ||
| encodingConfidence | No |