Overview
All codebase tools are created viacreateCodebaseTools() which accepts:
code_search
Search the codebase for exact code patterns using ripgrep (text/regex search).Parameters
query(required): Exact text or regex pattern to search for. Use identifiers, type names, function names, or simple regexfileType(optional): File extension without dot to filter results (e.g. ‘ts’, ‘tsx’, ‘js’, ‘prisma’)maxResults(optional, default: 10): Maximum number of results to return
Usage
Best practices
- Use exact identifiers, type names, function names (e.g. ‘ActivityEntry’, ‘parentId’)
- Use simple regex for variations (e.g. ‘Comment.*Thread’, ‘function.*create’)
- Avoid semantic queries (e.g. ‘activity history model’)
- For conceptual queries, use
semantic_code_searchinstead
Returns
semantic_code_search
Semantic search over the codebase for conceptual queries using vector embeddings.Parameters
query(required): Natural language query about code (e.g. ‘where do we handle authentication’)type(optional, default: ‘hybrid’): Search mode - ‘semantic’ (vector only) or ‘hybrid’ (vector + rerank)limit(optional, default: 5): Maximum results to returnlanguage(optional): Language filter (e.g. ‘typescript’, ‘python’)
Usage
Returns
Array of search results with semantic similarity scores and code snippets.read_file
Read the contents of a code file, optionally with line range selection.Parameters
filePath(required): Path to file (absolute or relative to codebase paths)lineStart(optional): Starting line number (1-indexed)lineEnd(optional): Ending line number (1-indexed, inclusive)
Usage
Returns
list_directory
List the contents of a directory with optional recursive traversal.Parameters
directoryPath(required): Path to directory (absolute or relative to codebase paths)recursive(optional, default: false): If true, recursively list all subdirectories
Usage
Returns
find_components
Find React components in the codebase matching a name pattern.Parameters
namePattern(optional): Regex pattern to match component names (e.g. ‘Button’, ’.*Form’)directory(optional): Subdirectory to search within (e.g. ‘components’, ‘features’)
Usage
Returns
export function Component) and arrow function components (export const Component =).
get_routes
Find all page routes in a Next.js or similar app router structure.Parameters
appDirectory(optional, default: ‘app’): The app directory to scanincludeApi(optional, default: true): Whether to include API routes
Usage
Returns
feature_status
Check the status of a feature in the codebase including implementation status, feature flags, and test coverage.Parameters
featureName(required): Name of the feature to check