Skip to main content
Glama

search_codebase

Find code patterns, functions, classes, or specific content across a workspace using regex, names, or natural language, with optional file-type filters and surrounding context.

Instructions

Search for code patterns, functions, classes, or specific content across the workspace

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
queryYesSearch query (can be regex, function names, or natural language)
fileTypesNoFile extensions to search in (e.g., [".ts", ".js", ".py"])
includeContextNoInclude surrounding context for matches

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations, the description carries the full disclosure burden, yet it only implies a read-only lookup. It says nothing about whether results are capped, paginated, ranked, or what the returned match structure looks like, nor whether the search is scoped to indexed files or the whole workspace.

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?

A single front-loaded sentence with no filler; the verb and the searchable artifact types come first. Nothing could be removed without losing information.

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

Completeness3/5

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

For a three-parameter, annotation-free, output-schema-less tool, the definition covers what is searched but not result behavior (limits, ordering, context windows) or how it relates to sibling tools. Adequate to invoke, thin for interpreting what comes back.

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 query, fileTypes, and includeContext are already documented with types, defaults, and examples; baseline 3 applies. The description adds only the hint that patterns/functions/classes are fair game, which is largely redundant with the schema's 'can be regex, function names, or natural language'.

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 (search) plus the resource and scope (code patterns, functions, classes, specific content across the workspace), which is more concrete than a generic 'search the codebase'. It does not, however, distinguish itself from siblings such as get_project_patterns or analyze_workspace, so an agent has to infer the boundary.

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

Usage Guidelines2/5

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

There is no when-to-use or when-not-to-use guidance and no named alternative, despite siblings that plausibly overlap (get_project_patterns, analyze_workspace, get_file_dependencies). Usage is only implied by the verb 'search'.

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