Elffuss BraidHub

kikocis/continue public

main · 2.0 KiBRawPermalink
1import { Tool } from "../..";
2import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
3
4export const readFileRangeTool: Tool = {
5 type: "function",
6 displayTitle: "Read File Range",
7 wouldLikeTo:
8 "read lines {{{ startLine }}}-{{{ endLine }}} of {{{ filepath }}}",
9 isCurrently:
10 "reading lines {{{ startLine }}}-{{{ endLine }}} of {{{ filepath }}}",
11 hasAlready:
12 "read lines {{{ startLine }}}-{{{ endLine }}} of {{{ filepath }}}",
13 readonly: true,
14 isInstant: true,
15 group: BUILT_IN_GROUP_NAME,
16 function: {
17 name: BuiltInToolNames.ReadFileRange,
18 description:
19 "Use this tool to read a specific range of lines from an existing file. Only supports positive line numbers (1-based from start). For reading from the end of a file, use the terminal tool with 'tail' command instead.",
20 parameters: {
21 type: "object",
22 required: ["filepath", "startLine", "endLine"],
23 properties: {
24 filepath: {
25 type: "string",
26 description:
27 "The path of the file to read, relative to the root of the workspace (NOT uri or absolute path)",
28 },
29 startLine: {
30 type: "number",
31 description:
32 "The starting line number (1-based from start). Must be a positive integer. Example: 1 = first line, 10 = tenth line",
33 },
34 endLine: {
35 type: "number",
36 description:
37 "The ending line number (1-based from start). Must be a positive integer greater than or equal to startLine. Example: 10 = tenth line, 20 = twentieth line",
38 },
39 },
40 },
41 },
42 systemMessageDescription: {
43 prefix: `To read a specific range of lines from a file, use the ${BuiltInToolNames.ReadFileRange} tool. Only supports positive line numbers (1-based from start). For reading from the end of files, use the terminal tool with 'tail' command instead:`,
44 exampleArgs: [
45 ["filepath", "path/to/the_file.txt"],
46 ["startLine", 10],
47 ["endLine", 20],
48 ],
49 },
50 defaultToolPolicy: "allowedWithoutPermission",
51 toolCallIcon: "DocumentIcon",
52};