Skip to main content
Glama

search_code

Read-only

Find code patterns across the project using case-insensitive regex to locate every match with file paths, line numbers, and matched content before making changes.

Instructions

Search for code patterns across the project using case-insensitive regex. Returns all matches with file paths, line numbers, and matched content. Use this to find where code patterns exist before making changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesText or regex pattern to search for (e.g., 'handleClick', 'Button.*onClick')
file_globNoGlob pattern for files to search (default: '**/*.{py,jsx,js,tsx,ts}')**/*.{py,jsx,js,tsx,ts}

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.9.0

TDQS

A4/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true; the description adds useful behavioral details beyond that, such as case-insensitive regex matching and the exact shape of results (file paths, line numbers, matched content). It is consistent with the read-only annotation and provides meaningful context without contradiction.

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?

Two sentences convey the operation, regex behavior, return contents, and a guiding use case with no redundant or filler language. The most decision-relevant detail is front-loaded.

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, read-only two-parameter search tool with no output schema, the description covers key runtime behavior: regex matching, result contents, and search scope. It omits minor details like regex flavor or default file glob, but those are already listed in the schema.

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 fully documents both parameters with examples and defaults. The description reinforces that the pattern is regex-based but does not add meaningful parameter semantics beyond what the schema provides, so a baseline 3 is 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?

The description clearly states the tool searches for code patterns using case-insensitive regex and returns file paths, line numbers, and matched content. It is specific about the resource (code) and the operation (search), though it does not explicitly distinguish itself from the similarly named sibling search_codebase.

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?

The final sentence gives a clear intended use ('Use this to find where code patterns exist before making changes'). It does not mention when not to use it or explicitly name alternatives, so it falls just short of the strongest guidance.

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