Skip to main content
Glama

search_code

Search repository files for literal text or regular expressions, returning matched lines with line numbers and file paths. Use optional path, case sensitivity, and result limits to focus code searches.

Instructions

Search for literal text or regular expressions across repository files.

Args: query: The substring or regex to search for. path: Optional relative directory or file to constrain search scope. is_regex: Whether query is a regular expression (default: False). case_sensitive: Whether match should be case-sensitive (default: False). max_results: Maximum matching lines to return (default: 50).

Returns: JSON string with matched lines, line numbers, and file paths.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo
queryYes
is_regexNo
max_resultsNo
case_sensitiveNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior3/5

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

With no annotations provided, the description carries the full behavioral burden. It discloses matching modes, defaults, result limits, and return format, which is solid, but it does not mention regex flavor, whether the search respects ignore files, or behavior on binary files. These are non-trivial but not critical 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?

The description is front-loaded with a one-sentence purpose, followed by a terse Args list and a clear Returns line. Every sentence earns its place; some redundancy with schema defaults exists but is minor and supports quick scanning.

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 five-parameter tool with no annotations, the description covers the operation, parameters, and return shape well, and an output schema is present. It is complete enough for correct invocation, though a note on regex flavor and path resolution would make it fully self-contained.

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?

Schema description coverage is 0%, so the description must and does compensate by explaining each parameter's purpose and default value in the Args section. It adds meaning beyond bare schema titles, though it leaves small nuances like path semantics and regex syntax details implicit.

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?

The description states a specific verb ('Search') and resource ('repository files') and clearly distinguishes from siblings by emphasizing content search with literal or regex matching. It also explains the tool's core distinction from read_file or list_files without needing to name them.

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 description makes clear when to use the tool: when you need to find matching lines across repository files, optionally constrained by a path. It omits explicit 'when not to use' guidance, but the context is unambiguous enough that an agent can select it correctly.

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