Skip to main content
Glama

page_grep

Read-only

Find text inside a page's HTML, saved text, or PDF range using regex or literal matching, returning line numbers with context for precise follow-up reads and edits.

Instructions

Find text inside one page's HTML or a file page's saved text, like grep -n on a file. PDFs search embedded text in the selected pdfPage/pdfLimit range (default page 1), with document page markers; check pdf.nextPage and truncatedPages before concluding there are no matches in the document. Returns matching lines with their line numbers (12: a match, 11- context, -- between hunks), so you can page_read a window around them with offset/limit or copy an exact oldString for page_patch (HTML pages only). Leave the number prefix out of oldStrings. pattern is a JavaScript regex unless literal is true. Works on open and closed pages. To find which page has something, use library_search instead.

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": "page_grep"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoTab id, e.g. t_ab12cd34.
keyNoPage key, e.g. scribe:sprint-notes (the scribe: prefix is optional).
contextNoLines of context before and after each match (0–20). Default 0.
literalNoMatch pattern as plain text, not a regex.
patternYesRegex (JavaScript syntax) matched against each line, or plain text with literal: true.
pdfPageNoPDF only: first document page to search, 1-based. Default 1; returned pdf.nextPage continues.
pdfLimitNoPDF only: document pages to search (1–5). Default 1. Searches embedded text up to 20,000 characters per page; check pdf.truncatedPages and pdf.nextPage.
ignoreCaseNoCase-insensitive match.
maxMatchesNoShow at most this many matches. Default 50; the total is still counted.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only supply readOnlyHint, so the description carries most of the load and does so: it documents the return format (`12:` match, `11-` context, `--` between hunks), the PDF page-window behavior with pdf.nextPage, per-page character truncation with truncatedPages, and the warning to check those before concluding no matches exist. It also warns to strip the line-number prefix before reusing text as oldString, which is a real failure mode the annotation cannot express.

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?

Front-loads the core purpose and the sibling disambiguation, and nearly every clause carries actionable content. It is dense, though — the oldString-prefix caveat and the PDF truncation caveats are packed into long sentences that an agent must parse carefully.

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?

With 9 parameters, no output schema, and an output format (grep-style line prefixes, pdf.nextPage metadata) that is not modeled structurally, the description supplies exactly what is missing: the shape of the response, pagination continuation, and truncation limits. An agent can call this correctly and interpret the results without further information.

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 coverage is 100%, so the baseline is 3; the description earns above that by explaining the interaction of pattern with literal ('pattern is a JavaScript regex unless literal is true') and by tying pdfPage/pdfLimit defaults to the returned pdf.nextPage cursor rather than restating the schema. It leaves maxMatches and ignoreCase entirely unaddressed in prose, which keeps it short of a 5.

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 and resource ('Find text inside one page's HTML or a file page's saved text') and grounds it with an analogy ('like grep -n on a file'). It explicitly distinguishes itself from library_search ('To find which page has something, use library_search instead') and from page_read/page_patch by naming their complementary roles.

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

Usage Guidelines5/5

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

Gives explicit routing: use this to find line matches, then page_read a window with offset/limit, copy oldString for page_patch (HTML pages only), and use library_search to locate the page itself. It also states scope coverage ('Works on open and closed pages'), removing the main ambiguity an agent would have about whether the page must be open.

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