Skip to main content
Glama

extract_fields

Read-only

Extract structured data from a live authenticated browser as JSON using CSS selectors, with support for arrays, attributes, and HTML content.

Instructions

Declarative STRUCTURED extract: pass a {name: selector} map and get back ONE JSON object of values in a single call — against our real authenticated Chrome DOM (a login-walled / SPA page stateless scrapers can't reach). Grammar: name[]=array, sel@attr=attribute, sel@html=innerHTML, bare=text. Optional target scopes selectors to a subtree. Returns {fields, matched, misses, errors} — misses/errors let you fix a selector without re-reading the page. Reads text/attr/innerHTML only, never input values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
leaseNoOptional lease token to present if the target session is leased (0.7.0). Threaded per-call; never read from the server's env.
fieldsYesMap of field name → CSS selector (with optional @attr / @html / name[] array suffix).
targetNoOptional @eN / @text: / @label: / CSS root to scope all selectors to a subtree.
sessionNoOptional session name to target (omit for the shared 'default'). On a daemon shared with other agents, pass a UNIQUE name for stateful multi-step work (go→click→fill) so you don't collide on 'default'.
node_capNoCap nodes read per array field.
max_charsNoCap each field value's length.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already carry readOnlyHint=true and openWorldHint=true, so the safety profile is set. The description adds value by specifying exactly what is read ('Reads text/attr/innerHTML only, never input values') and disclosing the return shape {fields, matched, misses, errors} with the misses/errors iterative-fix mechanism. No contradiction with the annotations — the read-only claim aligns with readOnlyHint=true.

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?

The description is compact and front-loaded with the core purpose. Each sentence earns its place: purpose, grammar, target scoping, return shape, and read-only disclosure. It's dense but not bloated; could trim minor redundancy but overall efficient.

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?

No output schema exists, so the description correctly takes on the burden of explaining the return shape {fields, matched, misses, errors}, which it does. It covers the field grammar, target scoping, and read-only scope. The remaining parameters (lease, session, node_cap, max_chars) are fully covered by the schema's 100% description coverage. Fairly complete for a complex 6-param tool.

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 schema documents all six parameters. The description goes beyond the schema by explaining the selector grammar — name[]=array, sel@attr=attribute, sel@html=innerHTML, bare=text — giving semantic meaning to the suffixes the schema only lists. This is genuine additive value for the key fields parameter.

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: 'Declarative STRUCTURED extract' that takes a {name: selector} map and returns 'ONE JSON object of values in a single call'. It distinguishes itself from siblings like extract, text, html, and attr by framing this as a batch structured extraction against the authenticated Chrome DOM that stateless scrapers can't reach.

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?

Provides clear context on when to use: against the real authenticated Chrome DOM that stateless scrapers can't reach, and for pulling multiple fields in one call. It notes misses/errors let you fix a selector without re-reading the page, and that it never reads input values (an implicit exclusion for value reads). However, it doesn't explicitly name sibling alternatives or give hard when-not-to-use conditions.

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