Skip to main content
Glama

search_code

Finds functions across indexed repositories by meaning from natural-language queries, returning symbol, file, line range, and summary pointers so you can locate code when the name is unknown.

Instructions

Semantic search over indexed repos' functions BY MEANING.

Use for conceptual questions where you don't know the name of the
code: "where do we cache the signing keys", "code that retries
deleting a temp file", "how are search scores from two lists merged".
Do NOT use for literal identifiers, exact strings, or error messages
— use Grep for those.

Searches every indexed repo; pass repo="name" to search only one.

Returns up to k pointers: function name, file path relative to the
repo root, line range, kind, and the first sentence of an LLM-written
summary. Never returns source code: open the file in your checkout
(or grep the function name) to get the truth. The index is a snapshot
at one commit (see index_status): line numbers may have drifted, and
code written after that commit is not in it. Similarity is not
confidence — if the results look unrelated to each other, the concept
probably isn't in the index.

mode: "summary" (default, compares the query to each function's
summary), "code" (to the raw source), or "hybrid" (both, fused).

Input Schema

NameRequiredDescriptionDefault
kNo
modeNo
repoNo
queryYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does: it discloses that only pointers and an LLM-written summary are returned, never source code; that results reflect a single-commit snapshot whose line numbers may have drifted and which excludes newer code; and that similarity scores are not confidence. These are exactly the non-obvious traits that would otherwise cause misuse.

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

Conciseness5/5

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

Front-loaded with the core verb and meaning-based framing, then examples, exclusions, scope, return shape and caveats in descending priority. Despite its length, every sentence carries operational information — no filler or restatement of the tool name.

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?

For a 4-parameter semantic search tool with an output schema but no annotations, the description supplies the missing behavioral layer: result shape, snapshot staleness, cross-repo scope, and the interpretability caveat. An agent can call it correctly and interpret weak results without further information.

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

Parameters4/5

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

Schema coverage is 0% and every parameter's title is bare, so the description must compensate — and it largely does: repo="name" for single-repo scoping, k framed as 'up to k pointers', and mode's three values ('summary' default, 'code', 'hybrid') explained along with what each compares against. It does not state k's default or bounds, and query format is only conveyed by example.

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?

States a specific verb and resource — semantic (meaning-based) search over indexed repos' functions — and immediately contrasts with the literal-search alternative, Grep, and with the index_status sibling it depends on. An agent can distinguish all three without opening any schema.

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?

Explicit when-to-use (conceptual questions where the symbol name is unknown) with concrete query examples, explicit when-not-to-use (literal identifiers, exact strings, error messages) routed to Grep, and a scoping rule for the repo parameter. Nothing is left to inference.

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

Deploy Server

Other Tools