search_code
Find functions and classes in a codebase by describing their purpose. Natural language queries return ranked code snippets with file locations and relevance scores.
Instructions
Search the codebase using semantic similarity.
Use natural language descriptions of code you're looking for:
"function that handles user authentication"
"error handling for HTTP requests"
"database connection initialization"
"unit tests for the payment service"
Returns ranked code snippets with file locations and relevance scores. Combines vector similarity with keyword search for best results.
Best for: Finding functions/classes by purpose or behavior. Not for: Exact pattern matching or finding all occurrences of a variable. Use Grep for exact patterns; use semantic search to find relevant files first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural language search query | |
| language | No | Filter by language: python, javascript, typescript, etc. | |
| min_score | No | Minimum relevance score threshold (0-1) | |
| chunk_type | No | Filter by type: function, class, method, module | |
| max_results | No | Maximum results to return (1-50) | |
| file_pattern | No | Glob pattern to filter files, e.g., '**/*_test.py' |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| status | No | Server status: initializing, ready, or error | ready |
| matches | Yes | ||
| total_count | Yes | ||
| search_time_ms | Yes |