| 1 | import { Tool } from "../.."; |
| 2 | import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; |
| 3 | |
| 4 | export const globSearchTool: Tool = { |
| 5 | type: "function", |
| 6 | displayTitle: "Glob File Search", |
| 7 | wouldLikeTo: 'search for files like "{{{ pattern }}}"', |
| 8 | isCurrently: 'searching for files like "{{{ pattern }}}"', |
| 9 | hasAlready: 'searched for files like "{{{ pattern }}}"', |
| 10 | readonly: true, |
| 11 | isInstant: true, |
| 12 | group: BUILT_IN_GROUP_NAME, |
| 13 | function: { |
| 14 | name: BuiltInToolNames.FileGlobSearch, |
| 15 | description: |
| 16 | "Search for files recursively in the project using glob patterns. Supports ** for recursive directory search. Will not show many build, cache, secrets dirs/files (can use ls tool instead). Output may be truncated; use targeted patterns", |
| 17 | parameters: { |
| 18 | type: "object", |
| 19 | required: ["pattern"], |
| 20 | properties: { |
| 21 | pattern: { |
| 22 | type: "string", |
| 23 | description: "Glob pattern for file path matching", |
| 24 | }, |
| 25 | }, |
| 26 | }, |
| 27 | }, |
| 28 | defaultToolPolicy: "allowedWithoutPermission", |
| 29 | systemMessageDescription: { |
| 30 | prefix: `To return a list of files based on a glob search pattern, use the ${BuiltInToolNames.FileGlobSearch} tool`, |
| 31 | exampleArgs: [["pattern", "*.py"]], |
| 32 | }, |
| 33 | toolCallIcon: "MagnifyingGlassIcon", |
| 34 | }; |