Skip to main content
Glama

search_codebase

Read-onlyIdempotent

Find code by regex or semantic meaning, with each hit labeled by its containing function or class, so locating callers or usages takes one call instead of raw grep/rg scans.

Instructions

Use instead of Grep/rg on code. Each hit also names the function or class that contains it (in), so "who calls X" or "where is X used" takes one call. Regex by default; semantic=true ranks symbols by meaning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qNoAlias de `pattern`. Regex pattern (regex mode) or natural-language description (semantic mode).
queryNoAlias de `pattern`. Regex pattern (regex mode) or natural-language description (semantic mode).
regexNoAlias de `pattern`. Regex pattern (regex mode) or natural-language description (semantic mode).
patternNoRegex pattern (regex mode) or natural-language description (semantic mode).
projectNoProject name/path (default: active).
semanticNoIf true, interpret `pattern` as a description and rank symbols by embedding cosine similarity. Returns enriched hits with signature/docstring/score. Default false (regex).
max_resultsNoMaximum number of results to return (default 100, 0 = unlimited).
ignore_generatedNoSkip generated/minified files (default true). Regex mode only.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv4.20.0
    • addedInput schema / anyOf
      Added value: +[
      +  {
      +    "required": [
      +      "pattern"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "query"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "q"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "regex"
      +    ]
      +  }
      +]
    • addedInput schema / properties / q
      Added value: +{
      +  "description": "Alias de `pattern`. Regex pattern (regex mode) or natural-language description (semantic mode).",
      +  "type": "string"
      +}
    • addedInput schema / properties / query
      Added value: +{
      +  "description": "Alias de `pattern`. Regex pattern (regex mode) or natural-language description (semantic mode).",
      +  "type": "string"
      +}
    • addedInput schema / properties / regex
      Added value: +{
      +  "description": "Alias de `pattern`. Regex pattern (regex mode) or natural-language description (semantic mode).",
      +  "type": "string"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "pattern"
      -]
  2. Addedv4.0.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive, not open-world), so the bar is lower; the description still adds real behavior: regex-by-default with a semantic ranking mode, and that each hit carries an `in` containing-symbol annotation. It stops short of describing pagination or result volume behavior.

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?

Three tight sentences with zero waste; the use-instead-of guidance is front-loaded and the mode behavior is secondary. Every clause carries information.

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

Completeness4/5

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

For an 8-parameter read-only search tool with no output schema, the description conveys the core mental model (regex vs semantic, enriched hits). It doesn't explain the alias redundancy or default result limits, but nothing critical to calling it correctly is missing.

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%, so the schema already documents every parameter including aliases (q/query/regex) and semantic. The description only echoes the regex-vs-semantic distinction and adds no new parameter-level detail, making the documented 3 baseline appropriate.

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+resource (search the codebase) and immediately positions it against a known baseline ('instead of Grep/rg on code'). The added note that hits name the containing function/class via `in` clarifies the value over plain Grep, though it doesn't explicitly contrast with siblings like find_symbol or search_in_symbols.

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

Usage Guidelines4/5

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

Explicitly names the alternative it replaces ('Grep/rg on code') and gives the selecting condition ('who calls X' / 'where is X used'). It also distinguishes the two modes (regex default vs semantic=true), but gives no when-not guidance or tie-breaker against similarly-scoped siblings such as search_in_symbols or find_symbol.

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