Skip to main content
Semantic search requires the project to be indexed. CodeFire automatically indexes projects in the background when they are opened.
Perform semantic code search across the current project. Finds functions, classes, documentation, and git history matching a natural language query using hybrid vector similarity and keyword search.
query
string
required
Natural language description of what you’re looking for in the codebase
limit
integer
Maximum results to return (default: 10, max: 30)
types
array
Filter by chunk type. Available types: function, class, block, doc, commitOmit to search all types.
Returns: Array of matching code chunks with:
chunk_id
integer
Unique chunk identifier
type
string
Chunk type: function, class, block, doc, or commit
file_path
string
Relative path to the file containing this chunk
start_line
integer
Starting line number in the file
end_line
integer
Ending line number in the file
content
string
The actual code or text content
name
string | null
Function or class name if applicable
signature
string | null
Function signature or class declaration
score
number
Relevance score (higher is better)
Example:
{
  "name": "context_search",
  "arguments": {
    "query": "authentication middleware that validates JWT tokens",
    "limit": 5,
    "types": ["function", "class"]
  }
}
Response:
[
  {
    "chunk_id": 1234,
    "type": "function",
    "file_path": "src/middleware/auth.ts",
    "start_line": 15,
    "end_line": 42,
    "content": "export function validateJWT(token: string): User | null {\n  // ...\n}",
    "name": "validateJWT",
    "signature": "function validateJWT(token: string): User | null",
    "score": 0.92
  }
]

How Semantic Search Works

CodeFire’s semantic search uses a hybrid approach:
  1. Vector Embeddings: Code is embedded using OpenAI’s text-embedding-3-small model
  2. Keyword Matching: Traditional full-text search for exact matches
  3. Hybrid Ranking: Results are ranked by combining similarity scores and keyword relevance

Indexed Content

CodeFire indexes:
  • Functions: Function definitions and their bodies
  • Classes: Class declarations and methods
  • Blocks: Significant code blocks (loops, conditionals, etc.)
  • Documentation: Comments, docstrings, README files, markdown docs
  • Commits: Git commit messages and diffs

Best Practices

Instead of: “JWT auth middleware”Try: “middleware that checks if the user is authenticated using JWT tokens”
Instead of: “database query”Try: “function that queries the users table to find users by email address”
If you’re looking for a specific function, use types: ["function"] to exclude classes and documentation.
If results aren’t relevant, rephrase your query with more context or different terminology.

Notes

  • Requires project indexing (automatic when project is opened)
  • Uses OpenAI embeddings via OpenRouter API
  • Search is project-scoped (searches current project only)
  • Index updates incrementally as files change
  • Large projects may take several minutes to index initially

MCP Integration

Learn how to use semantic search in AI workflows

Project Management

How CodeFire manages and indexes projects

Build docs developers (and LLMs) love