search_code
Semantically search a codebase to find relevant code snippets with file paths and line numbers, reducing token usage by returning top matches instead of full files.
Instructions
Semantically search an indexed codebase for code relevant to a query.
Embeds the query and performs cosine similarity search against indexed
code chunks, returning the most semantically relevant snippets with
file paths and line numbers.
If the codebase is not yet indexed, it will be indexed automatically first.
Args:
query: Natural language description of what you're looking for.
E.g. "how does authentication work", "database connection setup"
path: Absolute path to the codebase root directory.
top_k: Number of results to return (default 8, max 20).
min_score: Minimum cosine similarity score to include a result (default 0.35).
Results below this threshold are filtered out as noise. Set to 0.0
to disable filtering.
Returns:
Formatted list of matching code chunks with file:line references and
similarity scores.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| query | Yes | ||
| top_k | No | ||
| min_score | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |