Skip to main content
Glama
Dasistaiden

whed-tools

by Dasistaiden

extract_data

Scrape a webpage and pull specific fields with CSS selectors, including text or attributes from JavaScript-rendered sites, then return or save results as JSON.

Instructions

Scrape a webpage and extract specific data using CSS selectors.

Args:
    url: The webpage to scrape
    css_selectors: List of CSS selectors (e.g., ["h1", "a.link", "#content"])
    attributes: List of attributes to extract for each selector (e.g., ["text", "href", "text"])
               If not provided, defaults to "text" for all selectors
    javascript: Set to True for JavaScript-rendered sites
    save_path: Optional file path to save the result as JSON (e.g. "C:/Users/me/Desktop/result.json").
               If a directory is given, a timestamped filename is generated automatically.

Returns:
    Dictionary with extracted data for each selector

Example:
    extract_data(
        url="https://example.com",
        css_selectors=["h1", "a"],
        attributes=["text", "href"]
    )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
save_pathNo
attributesNo
javascriptNo
css_selectorsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4/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 load, and it does so well: it discloses the default attribute ('text') when attributes is omitted, that javascript=True is needed for JS-rendered sites, and that a directory passed to save_path triggers an auto-generated timestamped filename. It omits any mention of auth requirements, rate limits, or error behavior.

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-loaded with the core purpose, then cleanly partitioned into Args/Returns/Example sections. The worked example earns its place by clarifying the two parallel list arguments, though the Args block is somewhat verbose for an agent runtime.

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?

For a five-parameter scraping tool with no annotations, the description covers inputs, defaults, output shape, and a usage example. Since an output schema exists, the Returns line is bonus rather than necessity, and the only real gap is operational context (auth, rate limits, failure modes).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it documents all five parameters with concrete semantics and inline examples (selectors list, parallel attributes list, url target, save path formats). Notably it explains the positional correspondence between css_selectors and attributes, which the schema does not.

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 first sentence states a specific verb and resource (scrape a webpage, extract data) plus the mechanism (CSS selectors), which is considerably more precise than the sibling names alone. It does not explicitly contrast itself against close siblings like extract_first or batch_scrape, but the mechanism and single-page scope make its purpose clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied rather than stated: the 'javascript' arg signals when to use it for JS-rendered sites and 'save_path' signals persistence, but there is no explicit rule for when to prefer this over scrape_url, batch_scrape, or crawl_website. The agent must infer routing from the sibling names.

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