| 1 | import { Tool } from "../.."; |
| 2 | import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; |
| 3 | |
| 4 | export const codebaseTool: Tool = { |
| 5 | type: "function", |
| 6 | displayTitle: "Codebase Search", |
| 7 | wouldLikeTo: "search the codebase for: {{{ query }}}", |
| 8 | isCurrently: "searching the codebase for: {{{ query }}}", |
| 9 | hasAlready: "searched the codebase for: {{{ query }}}", |
| 10 | readonly: true, |
| 11 | isInstant: false, |
| 12 | group: BUILT_IN_GROUP_NAME, |
| 13 | function: { |
| 14 | name: BuiltInToolNames.CodebaseTool, |
| 15 | description: |
| 16 | "Use this tool to semantically search through the codebase and retrieve relevant code snippets based on a natural language query. This helps find relevant code context for understanding or working with the codebase.", |
| 17 | parameters: { |
| 18 | type: "object", |
| 19 | required: ["query"], |
| 20 | properties: { |
| 21 | query: { |
| 22 | type: "string", |
| 23 | description: |
| 24 | "Natural language description of what you're looking for in the codebase (e.g., 'authentication logic', 'database connection setup', 'error handling')", |
| 25 | }, |
| 26 | }, |
| 27 | }, |
| 28 | }, |
| 29 | defaultToolPolicy: "allowedWithPermission", |
| 30 | systemMessageDescription: { |
| 31 | prefix: `To search the codebase, use the ${BuiltInToolNames.CodebaseTool} tool with a natural language query. For example, to find authentication logic, you might respond with:`, |
| 32 | exampleArgs: [ |
| 33 | ["query", "How is user authentication handled in this codebase?"], |
| 34 | ], |
| 35 | }, |
| 36 | }; |