Skip to main content
Glama

search_codebase

Read-only

Search a codebase by concept, symbol, identifier, or path to enumerate matches, resolve identifiers to symbols, and locate files for deeper context.

Instructions

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

For a how/where/why question call get_answer. Use this to enumerate matches, resolve an identifier to a symbol_id, or find files for get_context. Identifier, literal, a|b|c or regex queries return lines (path, line, kind, text; definitions first, one group per alternative; in names the enclosing symbol until it changes) read from live files; when complete is true they are every match, so no grep is needed. candidates lists distinct files to Read, best first.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "search_codebase"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNoimplementation | test | config | doc.
modeNoauto | symbol | path | concept | hybrid.auto
repoNoUsually omitted.
limitNoMax results, up to 20.
queryNoIdentifier, `a|b` alternation, regex, path, or natural language.
symbol_kindNofunction | class | method | ...

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed15 schema fields changedv0.62.0
    • removedInput schema / properties / kind / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / kind / description
      Added value: +"implementation | test | config | doc."
    • addedInput schema / properties / kind / type
      Added value: +"string"
    • addedInput schema / properties / limit / description
      Added value: +"Max results, up to 20."
    • addedInput schema / properties / mode / description
      Added value: +"auto | symbol | path | concept | hybrid."
    • removedInput schema / properties / page_type
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ]
      -}
    • removedInput schema / properties / pattern
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ]
      -}
    • addedInput schema / properties / query / description
      Added value: +"Identifier, `a|b` alternation, regex, path, or natural language."
    • removedInput schema / properties / repo / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / repo / description
      Added value: +"Usually omitted."
    • addedInput schema / properties / repo / type
      Added value: +"string"
    • removedInput schema / properties / symbol_kind / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / symbol_kind / description
      Added value: +"function | class | method | ..."
    • addedInput schema / properties / symbol_kind / type
      Added value: +"string"
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "result": {
      -      "additionalProperties": true,
      -      "title": "Result",
      -      "type": "object"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "title": "search_codebaseOutput",
      -  "type": "object"
      -}New value: +null
  2. Changed14 schema fields changedv0.60.1
    • removedInput schema / properties / kind / default
      Removed value: -null
    • removedInput schema / properties / kind / title
      Removed value: -"Kind"
    • removedInput schema / properties / limit / title
      Removed value: -"Limit"
    • removedInput schema / properties / mode / title
      Removed value: -"Mode"
    • removedInput schema / properties / page_type / default
      Removed value: -null
    • removedInput schema / properties / page_type / title
      Removed value: -"Page Type"
    • removedInput schema / properties / pattern / default
      Removed value: -null
    • removedInput schema / properties / pattern / title
      Removed value: -"Pattern"
    • removedInput schema / properties / query / title
      Removed value: -"Query"
    • removedInput schema / properties / repo / default
      Removed value: -null
    • removedInput schema / properties / repo / title
      Removed value: -"Repo"
    • removedInput schema / properties / symbol_kind / default
      Removed value: -null
    • removedInput schema / properties / symbol_kind / title
      Removed value: -"Symbol Kind"
    • removedInput schema / title
      Removed value: -"search_codebaseArguments"
  3. Changed3 schema fields changedv0.59.0
    • addedInput schema / properties / pattern
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Pattern"
      +}
    • addedInput schema / properties / query / default
      Added value: +""
    • removedInput schema / required
      Removed value: -[
      -  "query"
      -]
  4. Addedv0.39.0
  5. Removedv0.33.0
  6. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint, but the description adds substantial behavior: results are read from live files, definitions are ordered first, one group is emitted per alternation, and `complete=true` guarantees exhaustive matches so no grep is needed — a real cost/trust signal for the agent.

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?

Purpose is front-loaded and followed by the routing rule, so it is easy to scan. The long parenthetical describing `lines`/`in`/`complete` crams several output-contract facts into one dense sentence, which is informative but harder to parse.

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?

No output schema exists, and the description compensates by describing both return shapes (`lines` with path/line/kind/text and `candidates`) and their ordering, plus the `complete` flag. Combined with full param coverage, an agent has everything needed to call and interpret it.

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?

With 100% schema coverage the baseline is 3, but the description adds interpretation the schema lacks: query strings may be identifiers, literals, `a|b|c` alternations, or regexes, and each form produces grouped `lines` output. It does not explain `mode`, `kind`, or `limit` beyond what the schema already states.

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 ("Find code") plus the search modalities (concept, symbol, path), and immediately differentiates itself from the sibling get_answer by naming the question type that belongs there instead.

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?

Gives three concrete use cases (enumerate matches, resolve an identifier to a symbol_id, find files for get_context) and an explicit exclusion routing how/where/why questions to get_answer, so the agent can choose without opening another schema.

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