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.
4
+
// Base description without partial read instructions
5
+
letdescription=`## read_file
6
+
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.`
7
+
8
+
// Add partial read instructions only when partial reads are active
9
+
if(args.partialReadsEnabled){
10
+
description+=` By specifying start_line and end_line parameters, you can efficiently read specific portions of large files without loading the entire file into memory.`
11
+
}
12
+
13
+
description+=` 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.
6
14
Parameters:
7
-
- path: (required) The path of the file to read (relative to the current workspace directory ${args.cwd})
15
+
- path: (required) The path of the file to read (relative to the current workspace directory ${args.cwd})`
16
+
17
+
// Add start_line and end_line parameters only when partial reads are active
18
+
if(args.partialReadsEnabled){
19
+
description+=`
8
20
- 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.
21
+
- end_line: (optional) The ending line number to read to (1-based, inclusive). If not provided, it reads to the end of the file.`
22
+
}
23
+
24
+
description+=`
10
25
Usage:
11
26
<read_file>
12
-
<path>File path here</path>
27
+
<path>File path here</path>`
28
+
29
+
// Add start_line and end_line in usage only when partial reads are active
30
+
if(args.partialReadsEnabled){
31
+
description+=`
13
32
<start_line>Starting line number (optional)</start_line>
14
-
<end_line>Ending line number (optional)</end_line>
33
+
<end_line>Ending line number (optional)</end_line>`
34
+
}
35
+
36
+
description+=`
15
37
</read_file>
16
38
17
39
Examples:
18
40
19
41
1. Reading an entire file:
20
42
<read_file>
21
43
<path>frontend-config.json</path>
22
-
</read_file>
44
+
</read_file>`
45
+
46
+
// Add partial read examples only when partial reads are active
47
+
if(args.partialReadsEnabled){
48
+
description+=`
23
49
24
50
2. Reading the first 1000 lines of a large log file:
25
51
<read_file>
@@ -42,4 +68,7 @@ Examples:
42
68
</read_file>
43
69
44
70
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.`
0 commit comments