| 1 | import { Tool } from "../.."; |
| 2 | import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; |
| 3 | |
| 4 | export const grepSearchTool: Tool = { |
| 5 | type: "function", |
| 6 | displayTitle: "Grep Search", |
| 7 | wouldLikeTo: 'search for "{{{ query }}}"', |
| 8 | isCurrently: 'searching for "{{{ query }}}"', |
| 9 | hasAlready: 'searched for "{{{ query }}}"', |
| 10 | readonly: true, |
| 11 | isInstant: true, |
| 12 | group: BUILT_IN_GROUP_NAME, |
| 13 | function: { |
| 14 | name: BuiltInToolNames.GrepSearch, |
| 15 | description: |
| 16 | "Perform a search over the repository using ripgrep. Will not include results for many build, cache, secrets dirs/files. Output may be truncated, so use targeted queries", |
| 17 | parameters: { |
| 18 | type: "object", |
| 19 | required: ["query"], |
| 20 | properties: { |
| 21 | query: { |
| 22 | type: "string", |
| 23 | description: |
| 24 | "The search query to use. Must be a valid ripgrep regex expression, escaped where needed", |
| 25 | }, |
| 26 | }, |
| 27 | }, |
| 28 | }, |
| 29 | defaultToolPolicy: "allowedWithoutPermission", |
| 30 | systemMessageDescription: { |
| 31 | prefix: `To perform a grep search within the project, call the ${BuiltInToolNames.GrepSearch} tool with the query pattern to match. For example:`, |
| 32 | exampleArgs: [["query", ".*main_services.*"]], |
| 33 | }, |
| 34 | toolCallIcon: "MagnifyingGlassIcon", |
| 35 | }; |