Skip to main content
Glama

Grep Text

grep_text

Search page text with a regex pattern to find matches and return each match with surrounding context and line number, avoiding full text extraction.

Instructions

Regex-hunt page text. Cheaper than extract_text+scan. Returns [{match,context,line}].

Ex: grep_text('t0', 'API_KEY=\w+') → {"_untrusted":true,"matches":[{"match":"API_KEY=abc","context":"...","line":42}]}

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

Input Schema

NameRequiredDescriptionDefault
tab_idYes
patternYes
selectorNobody
max_matchesNo
context_charsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior3/5

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

No annotations exist, so the description carries the full burden; it does disclose the return shape and, via the example, that output is wrapped with '_untrusted': true, which is a genuinely useful behavioral signal. It does not say whether the page must be loaded first, which regex dialect is used, whether matching is case-insensitive, or what the default match cap does.

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 short lines plus a worked example, with the core purpose front-loaded and zero filler. The example earns its space by showing both input form and output shape.

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?

An output schema exists, so return values needn't be re-explained. However, for a 5-parameter tool with zero schema documentation, leaving selector/max_matches/context_chars entirely undiscussed is a real completeness gap an agent will feel when it needs to scope the search or widen context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across 5 parameters, and the description only implicitly covers tab_id and pattern from the example. The three optional tuning parameters (selector, max_matches, context_chars) are never mentioned, so their semantics and defaults are invisible without reading the raw schema.

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?

Names a specific verb and resource ('Regex-hunt page text') plus the return shape [{match,context,line}], which is concrete enough to distinguish it from extract_markdown or dom_query. It gestures at differentiation by saying it is 'cheaper than extract_text+scan', though it never names the more dangerous lookalike, find_by_text.

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?

Cost-based guidance ('cheaper than extract_text+scan') implies when to prefer it, but there are no exclusions and no routing to find_by_text, wait_for_text, dom_query or extract_text, all of which sit adjacent in the sibling list. The agent must infer the boundary itself.

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