Skip to main content
Glama
mxchris18
by mxchris18

extract_data

Scrape any URL and extract structured data matching your custom schema, returning JSON. Use an LLM to get specific fields like product info or article metadata.

Instructions

Scrape a URL and extract structured data matching a user-defined schema using an LLM. Returns a JSON object (or array if extract_as_list=true).

Use this when the user wants specific FIELDS from a page (e.g. product name, price, stock status; article author, date, summary).

PRE-FLIGHT REQUIRED — before calling:

  1. Call verify_provider_key(provider, 'llm') → get live model list

  2. Present models to user, ask them to choose one

  3. Ask: 'Is this a JavaScript-heavy page or SPA?' → js_render

  4. Present Contextual Retrieval is NOT applicable here (extraction only)

LLM keys can be omitted if OPENAI_API_KEY, ANTHROPIC_API_KEY, or GEMINI_API_KEY is set in the MCP environment config.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe web URL to scrape and extract structured data from.
schemaYesDict mapping field names to description strings. Example: {"title": "string — the product name", "price": "number — price in USD", "in_stock": "boolean — whether in stock"}
selectorNoOptional CSS selector to target a specific section before extraction.
js_renderNoUse headless browser to render JS before extracting. Ask the user before enabling.
llm_modelNoLLM model name from verify_provider_key. Do not guess or hardcode. Use an advanced model (not mini/flash/haiku) for long-form pages like documentation or legal docs.
llm_api_keyNoAPI key for the LLM provider. Can be omitted if set as env var.
llm_providerYesLLM provider. One of: 'openai', 'anthropic', 'gemini'. Call verify_provider_key first.
click_selectorNoCSS selector for an element to click after page load (tabs, accordions, load-more). Only used when js_render=true.
extract_as_listNoIf true, extracts ALL matching items on the page as a JSON array. Use for listing pages (product catalogues, article feeds).
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool uses an LLM for extraction, requires a provider key verification, supports optional headless rendering, and allows API keys via env vars. However, it does not mention rate limits, error handling, timeouts, or any side effects (though likely read-only). The transparency is adequate but could be more comprehensive.

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 well-structured with a main purpose, usage examples, and a clear 'PRE-FLIGHT REQUIRED' section. It is concise, with each sentence adding value. The use of bullet points in the pre-flight steps enhances readability. Slightly verbose in parts but overall efficient.

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?

Given the tool's complexity (9 parameters, no output schema), the description covers the main purpose, pre-flight process, and parameter details. However, it lacks details on the output format beyond 'returns a JSON object', error handling, or what happens if the schema cannot be matched. For a tool with nested objects and multiple optional parameters, this is a notable gap.

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?

The input schema has 100% description coverage, so the baseline is 3. The description adds significant meaning beyond the schema: it explains the purpose of the 'schema' parameter with an example, advises using advanced models for long pages, clarifies that 'llm_api_key' can be omitted if set as an env var, and explains when to use 'extract_as_list'. This extra context improves understanding.

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 description starts with a specific verb+resource combination ('scrape a URL and extract structured data') and includes examples of use cases (e.g., product name, price, stock status). It clearly conveys the tool's function of extracting user-defined fields via LLM. However, it does not explicitly differentiate from its sibling tool 'scrape_url', which also deals with URL content, leaving some ambiguity.

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?

The description provides clear guidance on when to use this tool (when the user wants specific fields from a page) and includes a 'PRE-FLIGHT REQUIRED' section with step-by-step instructions for the agent (call verify_provider_key, present models, ask about js_render). It also clarifies that Contextual Retrieval is not applicable. However, it does not explicitly state when NOT to use it or name alternative tools like 'scrape_url' for raw HTML extraction.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mxchris18/scrapedatshi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server