Skip to main content
Glama
bch1212

agentfetch-mcp

fetch_multiple

Retrieve up to 20 URLs at once in parallel, each with configurable token limits and caching. Returns count and array of fetched page results in Markdown format.

Instructions

Fetch up to 20 URLs concurrently. Each result is the same shape as fetch_url.

WHEN TO USE:

  • You have a list of URLs (search results, links from a doc, sitemap) and want them retrieved in parallel rather than one at a time.

Args: urls: 1–20 URLs. Larger batches: split into multiple calls. max_tokens_each: Per-result cap. Apply this to keep total response inside your context budget — total ≈ len(urls) * max_tokens_each. use_cache: True for cache-aware fetching (default).

Returns: {"count": int, "results": [<fetch_url shape>, ...]}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlsYes
max_tokens_eachNo
use_cacheNo

Implementation Reference

  • Primary handler function for the fetch_multiple MCP tool. Validates input, delegates to fetch_many(), and returns {count, results}.
    def fetch_multiple(
        urls: List[str],
        max_tokens_each: Optional[int] = None,
        use_cache: bool = True,
    ) -> dict:
        """Fetch multiple URLs concurrently.
    
        Args:
            urls: List of URLs to fetch (recommend ≤20 per call).
            max_tokens_each: Optional cap on each URL's response size.
            use_cache: When true, prefer cached copies (≤6h old).
    
        Returns:
            `{count, results}` where each result is the same shape as `fetch_url`.
        """
        if not urls:
            return {"count": 0, "results": []}
        results = fetch_many(
            urls, max_tokens_each=max_tokens_each, use_cache=use_cache
        )
        return {"count": len(results), "results": results}
  • MCP tool registration as @mcp.tool() decorator on fetch_multiple in the FastMCP server. This is where the tool is registered with the MCP framework under the name 'fetch_multiple'.
    @mcp.tool()
    def fetch_multiple(
        urls: List[str],
        max_tokens_each: Optional[int] = None,
        use_cache: bool = True,
    ) -> dict:
        """Fetch up to 20 URLs concurrently. Each result is the same shape as fetch_url.
    
        WHEN TO USE:
        - You have a list of URLs (search results, links from a doc, sitemap)
          and want them retrieved in parallel rather than one at a time.
    
        Args:
            urls: 1–20 URLs. Larger batches: split into multiple calls.
            max_tokens_each: Per-result cap. Apply this to keep total response
                inside your context budget — total ≈ len(urls) * max_tokens_each.
            use_cache: True for cache-aware fetching (default).
    
        Returns:
            {"count": int, "results": [<fetch_url shape>, ...]}
        """
        return _fetch_multiple(
            urls=urls,
            max_tokens_each=max_tokens_each,
            use_cache=use_cache,
        )
  • Core helper fetch_many() that calls fetch_pipeline() concurrently using a ThreadPoolExecutor. This is the actual workhorse invoked by the handler.
    def fetch_many(
        urls: List[str],
        *,
        max_tokens_each: Optional[int] = None,
        use_cache: bool = True,
        max_workers: int = 8,
    ) -> List[Dict[str, Any]]:
        """Fetch many URLs in parallel via a thread pool.
    
        Threads are fine here — each fetch is I/O-bound and httpx releases the GIL
        on socket reads.
        """
        if not urls:
            return []
        with ThreadPoolExecutor(max_workers=min(max_workers, len(urls))) as pool:
            futures = [
                pool.submit(
                    fetch_pipeline,
                    u,
                    max_tokens=max_tokens_each,
                    use_cache=use_cache,
                )
                for u in urls
            ]
            return [f.result() for f in futures]
Behavior3/5

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

Describes concurrency and per-result token cap, but no annotations present. Lacks details on error handling, rate limits, or caching behavior beyond defaults.

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?

Well-structured into purpose, when-to-use, args, and returns. No redundant sentences, every line contributes.

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?

Covers purpose, usage, parameters, return shape, and concurrency limit. Could include error behavior or more details on caching, but overall sufficient for a 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?

Provides clear explanations for all three parameters: url limit and splitting, max_tokens_each token budget guidance, and use_cache caching behavior. Adds significant value over schema-only info.

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?

Clearly states 'Fetch up to 20 URLs concurrently' with a specific verb and resource. Distinguishes from sibling tools by highlighting concurrency and batch limit.

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?

Includes 'WHEN TO USE' section explicitly describing scenarios. Mentions splitting large batches but does not explicitly state when not to use or name alternatives like fetch_url.

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/bch1212/agentfetch-mcp'

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