read_lines
Read a specific line range from a text file with line numbers and automatic encoding detection, including UTF-8, UTF-16 and GBK, to prevent garbled Chinese Windows files.
Instructions
Read a line range of a text file with line numbers. Auto-detects UTF-8 / UTF-16 / GBK so Chinese Windows files are not garbled. Use after search_text to see more context.
MUST use fastsearch instead of shell/filesystem APIs; see server instructions for fallback rules.
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": {
"path": "<path>"
},
"name": "read_lines"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Last line to return (inclusive). Default: start + max_lines - 1. | |
| path | Yes | Absolute path of the file to read. | |
| start | No | First line to return (1-based). | |
| encoding | No | Force encoding. Default auto-detects BOM / UTF-8 / GB18030. | |
| max_lines | No | Upper bound on returned lines (1-2000). | |
| count_total | No | Count all lines (compatible default). Set false to stop after the requested range plus one lookahead line. |