Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
n_resultsNo
vault_rootNo
chroma_pathNo
max_distanceNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It explains the vector search mechanism, confidence labeling based on cosine distance, max_distance tuning, fallback logic, and integration with Obsidian MCP tools. Fully transparent about behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Information-dense and structured with clear sections, but somewhat lengthy. Every sentence adds value, yet could be more concise without losing clarity. Front-loaded with purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given output schema exists (so return values need not be described), the description covers all relevant aspects: behavior, parameters, fallback, guardrails, and integration with sibling tools. Complete for an agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but description compensates thoroughly: explains query as natural language, n_results default, vault_root/chroma_path as optional env-var overrides, and max_distance as similarity threshold. Adds meaningful context beyond schema defaults.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches the codebase using semantic similarity for functional questions, and distinguishes it from sibling tools like search_simple and grep through explicit fallback and avoidance instructions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use (functional questions), when-not-to-use (avoid grep, vault_write only on user request), and fallback behavior (call search_simple on low confidence results). Includes detailed post-processing steps (read file directly, use vault_read).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ayush-Sadekar/codelore-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server