Skip to main content
Glama

Search Code

search_code

Find relevant code chunks across indexed repositories using hybrid semantic and keyword retrieval. Filter by language, path, or repo to answer coding questions and locate symbols or errors.

Instructions

Search indexed repositories for relevant code chunks using hybrid RAG.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "search_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNo"hybrid" (vector + BM25 RRF, recommended), "vector" (semantic only), or "keyword" (instant BM25).hybrid
queryYesNatural language question, symbol name, error message, or code pattern.
reposNoOptional list of repo_ids or filesystem paths to restrict search. Omit to search all repos.
top_kNoMaximum results to return (1-50, default 8).
languagesNoOptional language filter (e.g. ["tsx", "typescript", "python", "kotlin", "java", "dart"]).
path_prefixNoOptional relative path prefix filter (e.g. "src/auth/").

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden; it does convey that only indexed repositories are searchable (an implicit prerequisite for index_repo), which is genuinely useful. However, it omits cost/latency characteristics, ranking behavior, and whether the operation is strictly read-only, and its "hybrid RAG" phrasing conflicts with the schema's vector/keyword modes.

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?

One front-loaded sentence with no padding, which is appropriately sized for a simple search tool. It is slightly under-informative rather than verbose; the RAG acronym is the only questionable wording.

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

Completeness3/5

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

An output schema exists and the schema fully documents all six parameters, so the description needn't explain results. Still, for a 6-parameter tool with no annotations, the description should say that repositories must be indexed first and how it relates to the outline/overview siblings.

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

Parameters3/5

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

Schema description coverage is 100% and every parameter, including the mode enum and top_k bounds, is documented in the schema, so the baseline is 3. The description adds no parameter-level meaning and its "hybrid" framing is less accurate than the schema's three-mode description.

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

Purpose4/5

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

States a specific verb ("Search") and resource ("indexed repositories for relevant code chunks"), which is enough to distinguish it from the sibling status/outline/listing tools. The trailing "using hybrid RAG" is jargon that adds little and arguably narrows the apparent scope of a tool that also supports vector and keyword modes.

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

Usage Guidelines2/5

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

There is no when-to-use guidance at all: nothing tells the agent how this differs from get_symbol_outline or get_repo_overview, or when a semantic search is preferable to a symbol lookup. The only selection hints (which mode to pick) live in the schema, not the description.

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