Skip to main content
Glama

search_codebase

Locate code patterns across your codebase using grep-compatible regex queries. Filter by directory and file pattern to target specific files.

Instructions

Search the codebase using grep. Pass a regex-compatible query string and an optional directory path (absolute or relative) to search recursively. Defaults to the current working directory.

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_codebase"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe grep-compatible search query (regex supported)
includeNoOptional file pattern to filter by (e.g. '*.js', '*.ts'). Maps to grep --include.
directoryNoDirectory to search in. Accepts absolute paths (e.g. D:/projects) or relative paths. Defaults to current working directory..

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/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 usefully discloses that searching is grep-based and recursive and defaults to the working directory, but it omits the return format (matched lines, line numbers, file grouping), case sensitivity, and any result limits, leaving meaningful gaps.

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?

Three short sentences, front-loaded with the core mechanism and free of padding. The closing default-directory sentence partially duplicates the schema's default, but it is minor and useful for orientation.

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 a simple three-parameter search tool with full schema coverage and no output schema, the description gives enough to call it correctly. The main omission is what results look like, which is a small gap for a low-complexity tool.

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 all three parameters. The description restates the query-as-regex and directory-as-optional behavior but adds no syntax detail beyond the schema and never mentions the 'include' filter parameter.

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?

The description states a specific verb and resource ('Search the codebase using grep') and names the underlying mechanism, so an agent knows exactly what it does. It does not explicitly differentiate itself from the sibling read_file, but the search-vs-read distinction is implicit in the verb.

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

Usage Guidelines3/5

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

Usage context is implied by 'search recursively' and the default-directory note, but there is no explicit when-to-use or when-not guidance, and no mention of when to prefer read_file over searching. The agent must infer the appropriate situation.

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