Skip to main content
Glama

search_codebase

Find code by concept, symbol, or path in a repository. Returns ranked symbol and file hits for enumerating matches, resolving identifiers, or scoping context.

Instructions

Find code by concept, symbol, or path — hybrid codebase search.

For QUESTIONS ("how does X work", "where is Y handled", "why is Z like
this"), call get_answer instead: it runs this same hybrid retrieval
internally and synthesizes a cited answer, so searching first is a wasted
round-trip. Use this tool for the raw ranked hits: enumerating matches,
resolving an identifier to a symbol_id, or scoping get_context.

mode="auto" (default) routes the query: identifier-shaped queries search
the indexed symbols (returns symbol_id/path/line bounds — pipe into
get_symbol), path-shaped queries resolve files (pipe into get_context),
and conceptual queries run wiki-semantic search. Mixed queries run hybrid:
symbol hits first, then file-backed pages only. Decision records rank
below file pages unless the query is why-shaped.

Rows naming a file carry `path`; `candidates` is up to `limit`
distinct files to Read, best first.

Args:
    query: identifier, path, or natural language.
    limit: max results (default 5); distinct files outside
        mode="symbol" (same-file symbols in `symbols`).
    page_type: restrict to one page type. Common: file_page (per-file
        docs, always present) or module_page (subsystem/concept pages).
        Any stored type filters (repo_overview, layer_page, scc_page,
        api_contract, infra_page, symbol_spotlight).
    kind: implementation | test | config | doc (concept/symbol modes).
    repo: alias, or "all" for workspace-wide.
    mode: auto | concept | symbol | path | hybrid.
    symbol_kind: filter symbol hits by kind (function|class|method|...).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindNo
modeNoauto
repoNo
limitNo
queryYes
page_typeNo
symbol_kindNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.39.0
  2. Removedv0.33.0
  3. First observedv0.1.0

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and largely succeeds: it explains mode='auto' routing by query shape, the hybrid ordering rule ('symbol hits first, then file-backed pages'), and the ranking quirk that decision records fall below file pages unless why-shaped. It also describes the result shape (rows carry `path`, `candidates` is up to `limit` distinct files). Missing only operational traits like latency or auth/scoping caveats.

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?

Front-loaded correctly — purpose, then when-to-use, then routing behavior, then args — and no sentence is pure filler. It is dense and somewhat long, with a couple of parenthetical asides that could be tightened, but the structure is disciplined enough that length is earned.

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 7-parameter search tool with an output schema present, the description supplies everything needed to call it correctly: query-shape routing, result cardinality, ranking order, and how to chain the output into get_symbol or get_context. Return-value explanation is not needed since an output schema exists, yet it adds shape hints without redundancy.

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 description coverage is 0% and no enums are declared, so the description does all the work: it documents query, limit (default 5, with the subtlety that it counts distinct files outside mode='symbol'), page_type with concrete examples plus the other stored types, kind, repo ('alias, or "all"'), mode's five values, and symbol_kind. Every parameter is disambiguated beyond the raw type.

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?

Opens with a specific verb+resource framing ('Find code by concept, symbol, or path — hybrid codebase search') and immediately names the sibling it is not (get_answer). An agent can distinguish it from get_context, get_symbol, and get_answer 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?

Explicitly routes 'for QUESTIONS use get_answer instead' with the justification that search-first is a wasted round-trip, then enumerates the cases this tool IS for: enumerating matches, resolving an identifier to a symbol_id, scoping get_context. Alternatives and when-not conditions are both stated.

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