The search_semantic tool enables you to find code by describing what it does in plain English. Unlike traditional text search, semantic search understands the meaning and intent behind your query, making it ideal for exploring unfamiliar codebases or finding code when you don't know the exact function names.
Stellarion uses RoBERTa embeddings to create vector representations of your code. When you search, your query is converted to the same vector space and matched against the indexed code chunks based on semantic similarity rather than exact text matching.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | Yes | - | Natural language description of what you're looking for |
limit | number | No | 10 | Maximum number of results to return (max: 100) |
includeContext | boolean | No | false | Include surrounding code context in results |
mcp__stellarion__search_semantic query:"your search query" limit:10 includeContext:true
Natural Language:
Find all error handling and exception catching code
Direct MCP Call:
mcp__stellarion__search_semantic query:"error handling and exception catching" limit:20
Returns: Functions that handle errors, try-catch blocks, error middleware, error boundary components
Natural Language:
Show me the user authentication and login implementation
Direct MCP Call:
mcp__stellarion__search_semantic query:"user authentication login session management" includeContext:true
Returns: Login functions, auth middleware, session management code, JWT handling
Natural Language:
Where is input validation and sanitization done?
Direct MCP Call:
mcp__stellarion__search_semantic query:"input validation sanitization data cleaning"
Returns: Validation functions, schema definitions, sanitization utilities, form validators
Natural Language:
Find REST API endpoints for user management
Direct MCP Call:
mcp__stellarion__search_semantic query:"REST API endpoints user CRUD operations"
Returns: Route handlers, controller methods for user create, read, update, delete operations
Natural Language:
Show me database query and connection handling
Direct MCP Call:
mcp__stellarion__search_semantic query:"database query connection pooling SQL operations" limit:15
Returns: Database connection setup, query builders, ORM models, transaction handling
Each result includes:
| Field | Description |
|---|---|
| File path | Location of the matching code |
| Line numbers | Start and end lines of the code chunk |
| Code snippet | The matching code content |
| Relevance score | How closely the code matches your query (0.0-1.0) |
| Function/class name | Name of the containing element if applicable |
For optimal results, index your project first:
mcp__stellarion__index_project generateEmbeddings:true
Semantic search works best after the project has been indexed. Without indexing, results may be limited or unavailable.
includeContext:true to see surrounding code for better understanding| Aspect | Semantic Search | Pattern Search |
|---|---|---|
| Query type | Natural language | Regex/exact text |
| Best for | Finding by functionality | Finding exact syntax |
| Requires | Project indexing | No indexing needed |
| Example | "error handling" | catch\s*\(.*Error |
Use semantic search when you know what the code does; use pattern search when you know how the code looks.