search_code
Find relevant code chunks by querying a vector database with semantic similarity. Returns confidence-labeled results for functional questions about code behavior.
Instructions
Search the codebase using semantic similarity.
Use this for functional questions: how something works, where a function is defined, what a module does, or any vague/underspecified question about code behaviour. Searches a question-indexed vector database and returns the most relevant code chunks together with their vault summary.
Each result is labeled Confidence: high or low based on whether its cosine distance is within max_distance (default 1.35 — tune it lower for stricter matching, higher to allow more speculative results through).
FALLBACK — if this tool returns no results or all results are labeled low
confidence, call the Obsidian MCP search_simple tool with the same query
for a plain-text search across vault notes; do not grep the repo's source
as a substitute for search — the vault is the source of truth for locating
relevant code.
Once you've located relevant code via a result's file_path (an absolute
path into the target repo, not the vault), reading that file directly
with Read/Grep is expected and normal when you need exact/current detail
the vault summary doesn't cover — the vault summarizes, it doesn't
replace the source.
After finding results, use the Obsidian MCP vault_read tool to read full
vault notes — try the vault-relative path first, and fall back to the
absolute path if the Obsidian MCP rejects it (path format depends on how
the Obsidian MCP server resolves paths against the vault root).
GUARDRAIL: Never call the Obsidian MCP vault_write tool unless the user
explicitly requests it by name.
vault_root and chroma_path are optional — if omitted, the server uses the CODELORE_VAULT_ROOT and CODELORE_CHROMA_PATH environment variables. Pass them explicitly to query a different repo without reconfiguring the server. Resolves against the configured target repo (see server instructions) — not necessarily the current working directory.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| n_results | No | ||
| vault_root | No | ||
| chroma_path | No | ||
| max_distance | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |