read
Read files with automatic encoding detection and line numbers. Supports images, SVG, and flexible line range selection with offset/limit.
Instructions
Reads a file and returns its contents with line numbers. Encoding-aware: auto-detects file encoding (UTF-8, EUC-KR, Shift-JIS, etc.). Image files (PNG, JPG, GIF, BMP, WebP, TIFF, ICO) are returned as ImageContent (base64). SVG files are returned as text. Supports offset/limit for reading specific line ranges. Negative offset reads from end (e.g. offset=-5 reads last 5 lines). Offset accepts integer, string range "100-200", or [start, end] array. Accepts "path" as alias for "file_path". Relative paths are resolved against the server CWD (the directory from which agent-tool was launched).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | Absolute or relative path to the file to read | |
| path | No | Alias for file_path | |
| offset | No | Line offset. Integer (1-based, negative=from end), string range 'start-end', or [start,end] array. Default: 0 (all) | |
| limit | No | Maximum number of lines to read. Default: 0 (all) | |
| start_line | No | Alias for offset (1-based line number to start reading from) | |
| end_line | No | End line number (1-based, inclusive). Sets limit = end_line - start_line + 1 when used with start_line |