Skip to main content
Glama

extract_structured_data

Extract structured JSON fields and page metadata from a URL using custom CSS selectors, ideal for product listings, news metadata, and schema-driven web scraping.

Instructions

Extract structured JSON — page metadata (Open Graph, canonical URL, author, dates) and/or a custom CSS-selector schema — from a website.

What it does Fetches a URL and returns a structured object. With include_metadata=true it reads Open Graph tags (og:title, og:description, og:image), the canonical URL, author, and publication/modified dates. You can also pass a schema (property name -> CSS selector) to pull specific fields (e.g. {"title": "h1", "price": ".price", "rating": "span.rating"}) into a typed object.

How to use

  • Use for product listings, news/metadata, schema-driven extraction, and any time you need fields instead of prose.

  • schema keys become the JSON keys; values are CSS selectors. Leave schema empty to get metadata only.

  • include_metadata (default true) adds the Open Graph / author / date block. Set false for a lean result.

  • mode/css_selector/headers/cookies/proxy behave exactly as in extract_web_content.

Returns JSON object with the requested fields (and/or metadata). Missing selectors are omitted rather than failing the whole call. Non-http or private URLs fail with isError: true.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesTarget website URL to extract content and metadata from.
modeNoCrawl mode: 'fast' (native fetch) or 'deep' (Playwright Chromium).fast
proxyNoOptional HTTP/SOCKS5 proxy URL.
schemaNoOptional key-value map of property names to CSS selectors (e.g. { title: 'h1', price: '.price' }).
cookiesNoOptional custom HTTP cookies key-value dictionary.
headersNoOptional custom HTTP request headers key-value dictionary.
max_retriesNoMaximum retry attempts (default: 3).
css_selectorNoOptional CSS selector to scope content before processing.
include_metadataNoWhether to extract Open Graph tags, canonical URL, author, and date metadata (default: true).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations the description carries the full burden, and it delivers real behavioral detail: missing selectors are omitted rather than failing the call, and non-http/private URLs return isError: true. It adds defaults for include_metadata but does not cover auth, rate limits, or cost/latency differences between fast and deep mode.

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 one-line summary, then organizes detail under 'What it does', 'How to use', and 'Returns' headings, which makes scanning easy for a 9-parameter tool. It is slightly verbose with the section headers and parenthetical enumerations, but every line carries actionable content.

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?

No output schema exists, so the description explains the return shape, partial-failure behavior, and error signal, and documents the defaults for include_metadata and the schema parameter. An agent has everything needed to invoke and interpret results without consulting other tools.

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 baseline is 3, but the description adds genuine semantic value: schema keys become the JSON keys and values are CSS selectors (with a concrete example), include_metadata=true adds the OG/author/date block and false yields a lean result. mode/css_selector/headers/cookies/proxy are punted to a sibling tool's semantics, which is a mild indirection.

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: 'Extract structured JSON — page metadata ... and/or a custom CSS-selector schema — from a website.' It also implicitly distinguishes itself from the prose-returning sibling by framing output as 'fields instead of prose.' An agent can tell what it does and how it differs from extract_web_content without opening the schema.

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?

Gives concrete use cases ('product listings, news/metadata, schema-driven extraction') and a selection rule ('any time you need fields instead of prose'), plus a clarifying case ('Leave schema empty to get metadata only'). It stops short of explicitly naming extract_web_content as the alternative for prose, so the routing is implied rather than spelled out.

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