Read file
read_fileRead one text file in full or by line ranges, including multiple disjoint ranges, to retrieve exact content and line positions when you need a single file's data.
Instructions
Read a text file, whole or by line range (start_line/end_line, 1-based; ranges[] for several disjoint ranges of one file). Use when: you need one file's content. When truncated, call again with start_line=next_start_line. Avoid when: you need 2+ files (read_batch) or only size/mtime (get_file_info). Output: text (as preview in compact mode; preview_truncated marks a cut), first_line, last_line, total_bytes, truncated, next_start_line (when truncated). sha256 hashes the whole file and is safe as expected_sha256; text_sha256 covers only the returned text. Missing path gives not_found.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"relative_path": "<relative_path>"
},
"name": "read_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ranges | No | Multiple disjoint ranges of the SAME file (max 16). Use instead of multiple read_file calls. | |
| end_line | No | Last line (1-based, inclusive). | |
| max_bytes | No | Max bytes returned (default and max 1 MiB). | |
| start_line | No | First line (1-based). | |
| line_numbers | No | true prefixes each line with its line number (default false). | |
| relative_path | Yes | Workspace-relative ('.' = root); absolute/.. outside it rejected. |