Tools

search_semantic

AI-powered natural language code search

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.

How It Works

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.

When to Use

  • Finding code by functionality: "authentication logic" instead of searching for specific function names
  • Exploring unfamiliar codebases: Discover how features are implemented without knowing the codebase structure
  • Discovering similar implementations: Find code that does similar things across the project
  • Locating code when you don't know the names: Search by what the code does, not what it's called

Parameters

ParameterTypeRequiredDefaultDescription
querystringYes-Natural language description of what you're looking for
limitnumberNo10Maximum number of results to return (max: 100)
includeContextbooleanNofalseInclude surrounding code context in results

MCP Command Syntax

mcp__stellarion__search_semantic query:"your search query" limit:10 includeContext:true

Examples

Find Error Handling Code

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


Find Authentication Logic

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


Find Data Validation

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


Find API Endpoints

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


Find Database 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

Output Format

Each result includes:

FieldDescription
File pathLocation of the matching code
Line numbersStart and end lines of the code chunk
Code snippetThe matching code content
Relevance scoreHow closely the code matches your query (0.0-1.0)
Function/class nameName of the containing element if applicable

Requirements

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.

Tips for Better Results

  1. Be descriptive: Use natural language that describes the functionality you're looking for
  2. Use domain terms: Include terminology specific to your project or technology stack
  3. Combine concepts: "authentication with JWT tokens" is better than just "auth"
  4. Start broad, then narrow: If you get too many results, add more specific terms
  5. Include context: Use includeContext:true to see surrounding code for better understanding
AspectSemantic SearchPattern Search
Query typeNatural languageRegex/exact text
Best forFinding by functionalityFinding exact syntax
RequiresProject indexingNo 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.