extract_data
Extract specific fields from a web page (e.g., product name, price) using a custom schema. The LLM returns structured JSON data.
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:
Call verify_provider_key(provider, 'llm') → get live model list
Present models to user, ask them to choose one
Ask: 'Is this a JavaScript-heavy page or SPA?' → js_render
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
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The web URL to scrape and extract structured data from. | |
| schema | Yes | Dict mapping field names to description strings. Example: {"title": "string — the product name", "price": "number — price in USD", "in_stock": "boolean — whether in stock"} | |
| selector | No | Optional CSS selector to target a specific section before extraction. | |
| js_render | No | Use headless browser to render JS before extracting. Ask the user before enabling. | |
| llm_model | No | LLM 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_key | No | API key for the LLM provider. Can be omitted if set as env var. | |
| llm_provider | Yes | LLM provider. One of: 'openai', 'anthropic', 'gemini'. Call verify_provider_key first. | |
| click_selector | No | CSS selector for an element to click after page load (tabs, accordions, load-more). Only used when js_render=true. | |
| extract_as_list | No | If true, extracts ALL matching items on the page as a JSON array. Use for listing pages (product catalogues, article feeds). |