Skip to main content
Glama

search

Find file contents matching a regex (ripgrep syntax), returning up to 50 path:line:text matches to locate function definitions or usages before opening files; optionally limit by path or glob.

Instructions

Search file contents with a regular expression (ripgrep syntax) and return up to 50 matches as path:line:text. Use it to find where a function is defined or used before opening files. Optionally restrict to a sub-directory (path) or a file glob such as '*.py'.

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": {
      "pattern": "<pattern>"
    },
    "name": "search"
  }
}

Input Schema

NameRequiredDescriptionDefault
globNo
pathNo.
patternYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it discloses the regex dialect (ripgrep syntax), the result cap (up to 50), and the exact result format. It omits edge behavior such as what happens on regex errors, on zero matches, or whether the 50-cap truncates silently, which are meaningful for correctly interpreting results.

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?

Three sentences, front-loaded with the core action and output contract, then usage, then parameter hints. No filler and nothing buried.

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?

For a 3-parameter read/search tool with an output schema present, the description supplies everything needed: dialect, cap, result format, use case, and the meaning of both optional filters. No gaps that would cause a mis-call.

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 compensate, and it does: pattern is qualified as ripgrep regex syntax, path as an optional sub-directory restriction, and glob as a filename filter with a concrete example ('*.py'). That covers all three parameters with meaning beyond the bare schema types.

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?

States a specific verb+resource ("Search file contents with a regular expression") plus the exact output shape ("path:line:text", max 50). This is clearly distinguishable from siblings like view_file, diff, and bash, which do not search file contents.

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?

Gives an explicit usage context: "find where a function is defined or used before opening files," which implicitly routes the agent away from view_file toward this tool first. It stops short of naming alternatives or stating exclusions (e.g., when to prefer bash/grep or ripgrep flags), so it is strong but not fully prescriptive.

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