Skip to main content
Glama
andyliszewski

webcrawl-mcp

webcrawl_scrape

Fetch a web page by URL and extract its main article content as markdown.

Instructions

Fetch a URL and extract main content as markdown.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to scrape
timeoutNoRequest timeout in seconds (default: 30)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'webcrawl_scrape'. Decorated with @mcp.tool, it calls scrape() and returns content + source.
    @mcp.tool
    async def webcrawl_scrape(url: str, timeout: int = DEFAULT_TIMEOUT) -> dict:
        """Fetch a URL and extract main content as markdown.
    
        Args:
            url: The URL to scrape
            timeout: Request timeout in seconds (default: 30)
    
        Returns:
            Dict with:
              - content: markdown of the page's main content
              - source:  one of "static_http", "static_http_retry",
                         "firecrawl_transport_fallback", "firecrawl_quality_fallback"
                         (see Issue #1)
        """
        result = await scrape(url, timeout)
        return {"content": result.content, "source": result.source}
  • Tool registration via FastMCP. The 'mcp' FastMCP instance is used with @mcp.tool decorator to register webcrawl_scrape (and other tools).
    mcp = FastMCP("Webcrawl")
  • ProvenanceSource type literal and ScrapeResult dataclass define the output schema returned by webcrawl_scrape.
    ProvenanceSource = Literal[
        "static_http",
        "static_http_retry",
        "firecrawl_transport_fallback",
        "firecrawl_quality_fallback",
    ]
    
    
    @dataclass(frozen=True)
    class ScrapeResult:
        """Scrape output with provenance.
    
        Attributes:
            content: Extracted markdown content
            source: How the content was obtained (see ProvenanceSource)
        """
    
        content: str
        source: ProvenanceSource
  • The core scrape() function called by the handler. Fetches HTML, extracts content via trafilatura/markdownify, with fallback to Firecrawl and caching.
    async def scrape(url: str, timeout: int = DEFAULT_TIMEOUT) -> ScrapeResult:
        """Fetch URL and extract main content as markdown.
    
        Dispatch:
        - 2xx → local extraction (trafilatura → markdownify); Firecrawl as a
          quality fallback if the result is below MIN_CONTENT_LENGTH.
        - {403, 429, 503} → polite retry (429 only) and/or Firecrawl transport
          fallback, gated on POLITE_MODE and FALLBACK_ON_TRANSPORT_ERROR.
    
        See Issue #1 for design rationale.
    
        Args:
            url: The URL to scrape
            timeout: Request timeout in seconds
    
        Returns:
            ScrapeResult carrying content and provenance source.
        """
        cached = cache.get(url)
        if cached is not None:
            return cached
    
        kind, payload, source = await _fetch_html_or_fallback(url, timeout)
    
        if kind == "firecrawl":
            result = ScrapeResult(content=payload, source=source)
            cache.set(url, result)
            return result
    
        content = _extract(payload, url)
    
        if _is_low_quality(content) and firecrawl_configured():
            print(
                f"[webcrawl] content still low quality, trying Firecrawl for {url}",
                file=sys.stderr,
            )
            firecrawl_content = await scrape_with_firecrawl(url, timeout)
            if firecrawl_content and len(firecrawl_content) > len(content or ""):
                result = ScrapeResult(
                    content=firecrawl_content,
                    source="firecrawl_quality_fallback",
                )
                cache.set(url, result)
                return result
    
        result = ScrapeResult(content=content, source=source)
        cache.set(url, result)
        return result
Behavior2/5

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

No annotations provided, and description fails to disclose behaviors such as error handling, rate limits, or authentication requirements. It only states the action without depth.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, front-loaded with key action, no redundant words. Every part is essential.

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?

Output schema exists, so return values are covered. Description is minimal but sufficient for a simple scrape operation, though could provide more about content extraction behavior.

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

Parameters3/5

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

Schema coverage is 100%, so parameters are well-defined in schema. Description adds no extra meaning beyond 'fetch URL' and 'extract as markdown', not even mentioning timeout. Baseline 3 applies.

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?

Description clearly states it fetches a URL and extracts main content as markdown, with specific verb and resource. It distinguishes from siblings (crawl, map, search) by focusing on single-page extraction.

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?

No explicit guidance on when to use versus alternatives like crawling or mapping. The purpose is implicitly for single-page extraction, but lacks when-to-use or when-not-to-use context.

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/andyliszewski/webcrawl-mcp'

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