Skip to main content
Glama
yubinkim444

ai-first-scraper-mcp

fetch_page

Convert any webpage or PDF into clean, ad-free Markdown for use in LLM prompts, with optional token-based truncation.

Instructions

Fetch a single web page or PDF and return its main content as clean, ad-free Markdown — ready to drop into an LLM prompt.

Args: url: A fully-qualified http(s) URL. max_tokens: Optional soft cap on the returned Markdown (whitespace tokens). When exceeded, the body is truncated and a [...truncated] marker is appended.

Returns: The cleaned Markdown body of the page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
max_tokensNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The fetch_page tool handler: accepts a URL and optional max_tokens, sends a GET request to the upstream SCRAPER_URL/raw endpoint, and returns the response body as clean Markdown text.
    async def fetch_page(url: str, max_tokens: Optional[int] = None) -> str:
        """Fetch a single web page or PDF and return its main content as clean,
        ad-free Markdown — ready to drop into an LLM prompt.
    
        Args:
            url: A fully-qualified http(s) URL.
            max_tokens: Optional soft cap on the returned Markdown (whitespace
                tokens). When exceeded, the body is truncated and a
                `[...truncated]` marker is appended.
    
        Returns:
            The cleaned Markdown body of the page.
        """
        params: dict[str, str | int] = {"url": url}
        if max_tokens:
            params["max_tokens"] = max_tokens
        async with httpx.AsyncClient(timeout=DEFAULT_TIMEOUT) as client:
            resp = await client.get(f"{SCRAPER_URL}/raw", params=params)
            resp.raise_for_status()
            return resp.text
  • The tool is registered with FastMCP via the @mcp.tool() decorator on the fetch_page function.
    @mcp.tool()
  • Configuration constants: SCRAPER_URL (target endpoint for fetch_page), SEARCH_URL, and DEFAULT_TIMEOUT, all configurable via environment variables.
    SCRAPER_URL = os.getenv("SCRAPER_URL", "https://ai-first-scraper.onrender.com").rstrip("/")
    SEARCH_URL = os.getenv("SEARCH_URL", "https://ai-first-search.onrender.com").rstrip("/")
    DEFAULT_TIMEOUT = float(os.getenv("AFS_TIMEOUT", "45"))
Behavior4/5

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

No annotations exist, so the description carries full burden. It discloses truncation behavior with max_tokens, return format (clean Markdown), and purpose. Missing error handling details, but core behavior is clear.

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?

The description is extremely concise: a single sentence plus clean Args and Returns sections. No fluff, every sentence adds value.

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?

Given the presence of an output schema and sibling tools, the description provides enough context for typical use. Could mention error scenarios, but overall it's adequate for a single-page fetch tool.

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 fully compensates by explaining url as fully-qualified http(s) URL and max_tokens as soft cap with truncation marker. Adds critical context beyond the schema types.

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?

The description clearly states it fetches a single web page or PDF and returns clean Markdown. It contrasts with sibling tools: 'single' vs batch, and URL-based vs search, providing clear differentiation.

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?

The description implies use when you have a specific URL, but lacks explicit guidance on when to prefer this over fetch_pages_batch or search_web. No when-not or alternative scenarios are mentioned.

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/yubinkim444/ai-first-scraper-mcp'

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