Codebase Indexing
The codebase indexing tool walks a file tree, extracts symbols from source files, and builds a semantic search index. Supports TypeScript, JavaScript, Python, Go, Rust, and Java. Agents can search by symbol name, type signature, or natural language description.
Indexing a codebase
Send a POST /tools/codebase-index request with a path to start indexing. The tool walks the directory recursively, extracts symbols from each supported file, and writes vector embeddings to the search index.
bash
curl -X POST http://localhost:3000/tools/codebase-index \
-H 'Authorization: Bearer $JWT_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"path": "/workspace/my-project"}'Supported languages
| Language | Extensions | Symbol types extracted |
|---|---|---|
| TypeScript | .ts, .tsx | Functions, classes, interfaces, type aliases, enums, exported constants |
| JavaScript | .js, .jsx, .mjs | Functions, classes, exported constants |
| Python | .py | Functions, classes, methods, module-level assignments |
| Go | .go | Functions, methods, structs, interfaces, type declarations |
| Rust | .rs | Functions, structs, enums, traits, impl blocks |
| Java | .java | Classes, interfaces, methods, enums, annotations |
Searching
Once a codebase is indexed, agents can query it with POST /tools/codebase-search. Searches support free-text queries, an optional type filter to restrict results to a symbol kind, and a glob filter to narrow by file path.
bash
curl -X POST http://localhost:3000/tools/codebase-search \
-H 'Authorization: Bearer $JWT_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"query": "function that handles user authentication",
"type": "function",
"glob": "src/auth/**"
}'| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Natural language description, symbol name, or type signature to search for |
type | string | No | Filter by symbol kind: function, class, interface, type, enum, method |
glob | string | No | Restrict results to files matching this glob pattern (e.g. src/api/**) |
limit | number | No | Maximum number of results to return (default: 10) |
Configuration
yaml
tools:
codebaseIndexing:
enabled: true
excludePatterns:
- node_modules/**
- dist/**
- .git/**
- '**/*.min.js'
languages:
- typescript
- javascript
- python
- go
- rust
- javaℹThe index is incrementally updated on file change if the workspace watcher is enabled. Only modified files are re-parsed and re-embedded, keeping indexing overhead minimal during active development.