Read Text File
read_text_fileReads a file's contents as text, with parameters to limit output by lines or characters. Use to inspect single files within allowed directories.
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. Use the 'offset' and 'limit' parameters to read a window of characters, for example to continue after a truncated result; they cannot be combined with 'head' or 'tail'. Results longer than 50,000 characters are cut short, ending with a notice that says how to get the rest. Operates on the file as text regardless of extension. Only works within allowed directories.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| head | No | If provided, returns only the first N lines of the file | |
| path | Yes | ||
| tail | No | If provided, returns only the last N lines of the file | |
| limit | No | Maximum number of characters to return, clamped to the result cap | |
| offset | No | Character position to start reading from (default 0). Use the offset given in a truncation notice to continue |