| name | context-engine |
| description | Codebase search and context retrieval for any programming language. Hybrid semantic/lexical search with neural reranking. Use for code lookup, finding implementations, understanding codebases, Q&A grounded in source code, and persistent memory across sessions. |
Context-Engine
Search and retrieve code context from any codebase using hybrid vector search (semantic + lexical) with neural reranking.
Decision Tree: Choosing the Right Tool
What do you need?
|
+-- Find code locations/implementations
| |
| +-- Simple query --> info_request
| +-- Need filters/control --> repo_search
|
+-- Understand how something works
| |
| +-- Want LLM explanation --> context_answer
| +-- Just code snippets --> repo_search with include_snippet=true
|
+-- Find specific file types
| |
| +-- Test files --> search_tests_for
| +-- Config files --> search_config_for
|
+-- Find relationships
| |
| +-- Who calls this function --> search_callers_for
| +-- Who imports this module --> search_importers_for
|
+-- Git history --> search_commits_for
|
+-- Store/recall knowledge --> store, find
|
+-- Blend code + notes --> context_search with include_memories=true
Primary Search: repo_search
Use repo_search (or its alias code_search) for most code lookups. Reranking is ON by default.
{
"query": "database connection handling",
"limit": 10,
"include_snippet": true,
"context_lines": 3
}
Returns:
{
"results": [
{"score": 3.2, "path": "src/db/pool.py", "symbol": "ConnectionPool", "start_line": 45, "end_line": 78, "snippet": "..."}
],
"total": 8,
"used_rerank": true
}
Multi-query for better recall - pass a list to fuse results:
{
"query": ["auth middleware", "authentication handler", "login validation"]
}
Apply filters to narrow results:
{
"query": "error handling",
"language": "python",
"under": "src/api/",
"not_glob": ["**/test_*", "**/*_test.*"]
}
Search across repos:
{
"query": "shared types",
"repo": ["frontend", "backend"]
}
Use repo: "*" to search all indexed repos.
Available Filters
language- Filter by programming languageunder- Path prefix (e.g., "src/api/")path_glob- Include patterns (e.g., ["/*.ts", "lib/"])not_glob- Exclude patterns (e.g., ["**/test_*"])symbol- Symbol name matchkind- AST node type (function, class, etc.)ext- File extensionrepo- Repository filter for multi-repo setupscase- Case-sensitive matching
Simple Lookup: info_request
Use info_request for natural language queries with minimal parameters:
{
"info_request": "how does user authentication work"
}
Add explanations:
{
"info_request": "database connection pooling",
"include_explanation": true
}
Q&A with Citations: context_answer
Use context_answer when you need an LLM-generated explanation grounded in code:
{
"query": "How does the caching layer invalidate entries?",
"budget_tokens": 2000
}
Returns an answer with file/line citations. Use expand: true to generate query variations for better retrieval.
Specialized Search Tools
search_tests_for - Find test files:
{"query": "UserService", "limit": 10}
search_config_for - Find config files:
{"query": "database connection", "limit": 5}
search_callers_for - Find callers of a symbol:
{"query": "processPayment", "language": "typescript"}
search_importers_for - Find importers:
{"query": "utils/helpers", "limit": 10}
search_commits_for - Search git history:
{"query": "fixed authentication bug", "limit": 10}
change_history_for_path - File change summary:
{"path": "src/api/auth.py", "include_commits": true}
Memory: Store and Recall Knowledge
Use store (or memory_store) to persist information for later retrieval:
{
"information": "Auth service uses JWT tokens with 24h expiry. Refresh tokens last 7 days.",
"metadata": {"topic": "auth", "date": "2024-01"}
}
Use find to retrieve stored knowledge by similarity:
{"query": "token expiration", "limit": 5}
Use context_search to blend code results with stored memories:
{
"query": "authentication flow",
"include_memories": true,
"per_source_limits": {"code": 6, "memory": 3}
}
Index Management
qdrant_index_root - First-time setup or full reindex:
{}
With recreate (drops existing data):
{"recreate": true}
qdrant_index - Index only a subdirectory:
{"subdir": "src/"}
qdrant_prune - Remove deleted files from index:
{}
qdrant_status - Check index health:
{}
qdrant_list - List all collections:
{}
Workspace Tools
workspace_info - Get current workspace and collection:
{}
list_workspaces - List all indexed workspaces:
{}
collection_map - View collection-to-repo mappings:
{"include_samples": true}
set_session_defaults - Set defaults for session:
{"collection": "my-project", "language": "python"}
Query Expansion
expand_query - Generate query variations for better recall:
{"query": "auth flow", "max_new": 2}
Output Formats
json(default) - Structured outputtoon- Token-efficient compressed format
Set via output_format parameter.
Aliases and Compat Wrappers
Aliases:
code_search=repo_search(identical behavior)
Cross-server tools:
store/find— Memory server tools for persistent knowledgememory_store— Indexer-side convenience wrapper that writes to memory collection
Compat wrappers accept alternate parameter names:
repo_search_compat- Acceptsq,text,top_kas aliasescontext_answer_compat- Acceptsq,textas aliases
Use the primary tools when possible. Compat wrappers exist for legacy clients.
Error Handling
Tools return structured errors, typically via error field and sometimes ok: false:
{"ok": false, "error": "Collection not found. Run qdrant_index_root first."}
{"error": "Timeout during rerank"}
Common issues:
- Collection not found - Run
qdrant_index_rootto create the index - Empty results - Broaden query, check filters, verify index exists
- Timeout on rerank - Set
rerank_enabled: falseor reducelimit
Best Practices
- Start broad, then filter - Begin with a semantic query, add filters if too many results
- Use multi-query - Pass 2-3 query variations for better recall on complex searches
- Include snippets - Set
include_snippet: trueto see code context in results - Store decisions - Use
storeto save architectural decisions and context for later - Check index health - Run
qdrant_statusif searches return unexpected results - Prune after refactors - Run
qdrant_pruneafter moving/deleting files - Index before search - Always run
qdrant_index_rooton first use or after cloning a repo