Skip to main content
Glama

page.extract_text

Read-only

Extract readable text from a browser page or a specific element via CSS selector, XPath, or snapshot ref; target a single panel instead of the full page.

Instructions

Readable text of the page, or of one element when given a locator. Pass selector/ref to read a single panel instead of the whole page.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "page.extract_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
nthNoZero-based index when the locator matches several elements.
refNoSnapshot ref (eNN) from page.snapshot.
textNoVisible text of the element.
xpathNoXPath expression.
frame_idNoFrame to search within; see page.list_frames.
selectorNoCSS selector; pierces shadow DOM.
max_charsNo
target_idNoTarget handle (tgt_*). Omit for the active page.
browser_idNoBrowser handle (br_*). Omit to use the only running browser, or auto-launch one.
visible_onlyNoSkip visually-hidden (sr-only, clipped, off-screen) text that innerText still reports. Use on marketing pages whose first 1500 characters are an invisible SEO block.
include_hiddenNo
backend_node_idNoCDP backendNodeId, e.g. from inspector.pick.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so safety is covered. The description adds useful value by defining 'readable text' and by contrasting whole-page vs single-element scope. It omits other behavioral traits, such as whether the result is truncated by max_chars, what the return shape is, and what happens when a locator matches nothing or several nodes.

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?

Two short sentences that front-load the core behavior, with no filler. There is mild redundancy: the first sentence already says 'one element when given a locator' before the second sentence re-explains selector/ref for 'a single panel.'

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?

For a 12-parameter tool with no output schema, the description covers the primary mode switch but leaves truncation behavior (max_chars), the return type (plain string vs structured), and multi-match/empty-match behavior unexplained. The rich schema compensates for much of the gap but not all of it.

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 coverage is 83%, so the baseline is 3 and the schema does most of the work. The description adds meaning for selector/ref by explaining that they restrict the read to one panel, which is a real semantic contribution. However, max_chars has no description in either the schema or the description, and the interaction between visible_only and include_hidden is left to the schema alone.

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?

States a specific verb+resource combination: returns the readable text of the page, or of one element when a locator is supplied. It clearly separates the two operating modes. It does not name a sibling (e.g. page.snapshot or page.observe) to contrast with, so it stops short of a 5.

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?

Provides one concrete usage rule: pass selector/ref to read a single panel instead of the whole page. That is implied guidance for the element mode only. There is no when-to-use/when-not guidance relative to alternatives such as page.snapshot or page.observe, and no mention of when hidden text should be excluded.

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