You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: Request to read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. The output includes line numbers prefixed to each line (e.g. "1 | const x = 1"), making it easier to reference specific lines when creating diffs or discussing code. By specifying start_line and end_line parameters, you can efficiently read specific portions of large files without loading the entire file into memory. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string.
5
+
Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly.
6
+
6
7
Parameters:
7
-
- path: (required) The path of the file to read (relative to the current workspace directory ${args.cwd})
8
-
- start_line: (optional) The starting line number to read from (1-based). If not provided, it starts from the beginning of the file.
9
-
- end_line: (optional) The ending line number to read to (1-based, inclusive). If not provided, it reads to the end of the file.
8
+
- args (required): File read operations in the following format:
9
+
:path: File path (relative to workspace directory ${args.cwd})
10
+
:start_line: (optional) Starting line number (1-based)
11
+
:end_line: (optional) Ending line number (1-based, inclusive)
12
+
13
+
Multiple files can be read in a single request by separating entries with "======+++======". Each entry follows the same format with its own path and optional line range.
14
+
10
15
Usage:
11
16
<read_file>
12
-
<path>File path here</path>
13
-
<start_line>Starting line number (optional)</start_line>
14
-
<end_line>Ending line number (optional)</end_line>
17
+
<args>
18
+
:path:path/to/file
19
+
:start_line:1
20
+
:end_line:100
21
+
</args>
15
22
</read_file>
16
23
17
24
Examples:
18
25
19
-
1. Reading an entire file:
26
+
1. Reading a single file:
20
27
<read_file>
21
-
<path>frontend-config.json</path>
28
+
<args>
29
+
:path:src/app.ts
30
+
:start_line:1
31
+
:end_line:1000
32
+
</args>
22
33
</read_file>
23
34
24
-
2. Reading the first 1000 lines of a large log file:
35
+
2. Reading specific lines from multiple files:
25
36
<read_file>
26
-
<path>logs/application.log</path>
27
-
<end_line>1000</end_line>
37
+
<args>
38
+
:path:src/app.ts
39
+
:start_line:1
40
+
:end_line:1000
41
+
======+++======
42
+
:path:src/utils.ts
43
+
:start_line:10
44
+
:end_line:20
45
+
</args>
28
46
</read_file>
29
47
30
-
3. Reading lines 500-1000 of a CSV file:
48
+
3. Reading an entire file (omitting line ranges):
31
49
<read_file>
32
-
<path>data/large-dataset.csv</path>
33
-
<start_line>500</start_line>
34
-
<end_line>1000</end_line>
50
+
<args>
51
+
:path:config.json
52
+
</args>
35
53
</read_file>
36
54
37
-
4. Reading a specific function in a source file:
55
+
4. Reading multiple files with different ranges:
38
56
<read_file>
39
-
<path>src/app.ts</path>
40
-
<start_line>46</start_line>
41
-
<end_line>68</end_line>
57
+
<args>
58
+
:path:src/app.ts
59
+
:start_line:1
60
+
:end_line:50
61
+
======+++======
62
+
:path:src/utils.ts
63
+
:start_line:100
64
+
:end_line:150
65
+
======+++======
66
+
:path:package.json
67
+
</args>
42
68
</read_file>
43
69
44
-
Note: When both start_line and end_line are provided, this tool efficiently streams only the requested lines, making it suitable for processing large files like logs, CSV files, and other large datasets without memory issues.`
70
+
Note: Line ranges enable efficient streaming of specific portions from large files like logs or datasets.`
0 commit comments