Skip to main content
Glama

Extract Text

extract_text

Extracts the visible text of a selected element from a browser tab, piercing shadow DOM and same-origin iframes and optionally stripping zero-width characters and extra blank lines.

Instructions

innerText of selector. pierce walks shadow+same-origin iframes. denoise (default) strips zero-width chars + collapses 3+ blank lines lossless. For full articles prefer extract_markdown.

Ex: extract_text('t0','.article',2000) → {"_untrusted":true,"text":"Body…"} Ex: extract_text('t0','body',8000,denoise=False) → byte-exact

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>"
    },
    "name": "extract_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
pierceNo
tab_idYes
denoiseNo
selectorNobody
max_charsNo
force_refreshNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior3/5

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

With zero annotations, the description carries the full burden and does disclose meaningful traits: pierce traverses shadow DOM plus same-origin iframes (implying cross-origin content is excluded), denoise is lossless and strips zero-width characters, and output is wrapped with `_untrusted: true`. However, it never says what happens when text exceeds max_chars (silent truncation?), what force_refresh actually refreshes, or how a missing selector fails — significant gaps for a mutation-free but state-dependent read.

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?

Front-loaded mechanism first, then the non-obvious flags, then a routing hint, then two compact worked examples. Every fragment carries information; there is no filler. The telegraphic style is dense but not wasteful.

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?

An output schema exists, so return structure needn't be spelled out, and the description still flags the `_untrusted` wrapper as a bonus. For a six-parameter, zero-coverage, annotation-free tool the coverage is good but not exhaustive — truncation behavior, force_refresh, and failure modes are absent.

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 0%, so the description has to compensate, and it largely does: pierce and denoise get real semantic explanations rather than restated defaults, selector is tied to innerText, and the two examples concretely demonstrate tab_id, selector, and max_chars usage including a denoise override. force_refresh is entirely unexplained and max_chars is only shown by example (its truncation semantics remain ambiguous), which keeps it from a 5.

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?

The opening ('innerText of selector') names the extraction mechanism and resource concretely, and the closing sentence distinguishes it from the sibling `extract_markdown` for long-form content. It never explicitly says it operates on a specific browser tab, but the tab_id example makes that inferable. Clear enough that an agent can separate it from extract_markdown, grep_text, or dom_query.

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?

Explicit conditional routing is provided: 'For full articles prefer `extract_markdown`', which is a real when-to-use-else signal. No exclusions are given against other plausible siblings (grep_text, wait_for_text, aria_snapshot), so it stops short of a full 5.

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