| 1 | import { Tool } from "../.."; |
| 2 | |
| 3 | import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; |
| 4 | |
| 5 | export const lsTool: Tool = { |
| 6 | type: "function", |
| 7 | displayTitle: "ls", |
| 8 | wouldLikeTo: "list files in {{{ dirPath }}}", |
| 9 | isCurrently: "listing files in {{{ dirPath }}}", |
| 10 | hasAlready: "listed files in {{{ dirPath }}}", |
| 11 | readonly: true, |
| 12 | isInstant: true, |
| 13 | group: BUILT_IN_GROUP_NAME, |
| 14 | function: { |
| 15 | name: BuiltInToolNames.LSTool, |
| 16 | description: "List files and folders in a given directory", |
| 17 | parameters: { |
| 18 | type: "object", |
| 19 | properties: { |
| 20 | dirPath: { |
| 21 | type: "string", |
| 22 | description: |
| 23 | "The directory path relative to the root of the project. Use forward slash paths like '/'. rather than e.g. '.'", |
| 24 | }, |
| 25 | recursive: { |
| 26 | type: "boolean", |
| 27 | description: |
| 28 | "If true, lists files and folders recursively. To prevent unexpected large results, use this sparingly", |
| 29 | }, |
| 30 | }, |
| 31 | }, |
| 32 | }, |
| 33 | defaultToolPolicy: "allowedWithoutPermission", |
| 34 | systemMessageDescription: { |
| 35 | prefix: `To list files and folders in a given directory, call the ${BuiltInToolNames.LSTool} tool with "dirPath" and "recursive". For example:`, |
| 36 | exampleArgs: [ |
| 37 | ["dirPath", "path/to/dir"], |
| 38 | ["recursive", "false"], |
| 39 | ], |
| 40 | }, |
| 41 | toolCallIcon: "FolderIcon", |
| 42 | }; |