Skip to main content
Glama
alexyangjie

Multi Fetch MCP Server

by alexyangjie

fetch_multi

Fetches multiple URLs simultaneously and returns an array of contents or error messages for each request.

Instructions

Fetches multiple URLs in parallel and returns an array of results. Each element corresponds to an input fetch request and includes either the fetched content or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestsYesList of fetch requests to process in parallel

Implementation Reference

  • Pydantic schema for the fetch_multi tool, defining input as a list of Fetch requests.
    class FetchMulti(BaseModel):
        """Parameters for fetching multiple URLs in parallel."""
        requests: list[Fetch] = Field(
            ..., description="List of fetch requests to process in parallel"
        )
  • Registration of fetch_multi as a Tool with its schema, inside list_tools().
    Tool(
        name="fetch_multi",
        description="""Fetches multiple URLs in parallel and returns an array of results. Each element corresponds to an input fetch request and includes either the fetched content or an error message.""",
        inputSchema=FetchMulti.model_json_schema(),
    ),
  • Handler for fetch_multi: validates input, runs parallel fetch_single tasks via asyncio.gather, handles truncation and errors per URL, and returns JSON array of results.
    if name == "fetch_multi":
        try:
            multi = FetchMulti.model_validate(arguments)
        except Exception as e:
            raise McpError(ErrorData(code=INVALID_PARAMS, message=str(e)))
    
        async def fetch_single(req: Fetch) -> dict:
            url = str(req.url)
            try:
                if not ignore_robots_txt:
                    await check_may_autonomously_fetch_url(url, user_agent_autonomous, proxy_url)
                content, prefix = await fetch_url(
                    url, user_agent_autonomous, force_raw=req.raw, proxy_url=proxy_url
                )
                original_length = len(content)
                if req.start_index >= original_length:
                    content_text = "<error>No more content available.</error>"
                else:
                    truncated = content[req.start_index : req.start_index + req.max_length]
                    if not truncated:
                        content_text = "<error>No more content available.</error>"
                    else:
                        content_text = truncated
                        actual_content_length = len(truncated)
                        remaining_content = original_length - (req.start_index + actual_content_length)
                        if actual_content_length == req.max_length and remaining_content > 0:
                            next_start = req.start_index + actual_content_length
                            content_text += f"\n\n<error>Content truncated. Call the fetch tool with a start_index of {next_start} to get more content.</error>"
                return {"url": url, "prefix": prefix, "content": content_text}
            except McpError as e:
                return {"url": url, "error": str(e)}
    
        tasks = [fetch_single(req) for req in multi.requests]
        results = await asyncio.gather(*tasks)
        return [TextContent(type="text", text=json.dumps(results))]
  • Registration of fetch_multi as a Prompt in list_prompts().
    Prompt(
        name="fetch_multi",
        description="Fetch multiple URLs in parallel and return their contents as an array of results",
        arguments=[
            PromptArgument(
                name="requests",
                description="JSON array of fetch requests, each with url, max_length, start_index, and raw",
                required=True,
            ),
        ],
    ),
Behavior4/5

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

The description discloses parallel execution and return structure with error messages, which is sufficient for a read-only tool with no annotations. No behavioral contradictions.

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 a single, well-structured sentence that efficiently conveys the core functionality with no wasted words.

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?

The description covers parallel execution and return format (content or error), which is complete for a batch fetch tool. However, it does not detail the exact structure of the result objects.

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 description coverage is 100% and the Fetch sub-object params are well-described. The description adds no extra meaning beyond 'multiple URLs in parallel', so baseline 3 is appropriate.

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 'Fetches multiple URLs in parallel' with a verb and resource, and the parallel aspect distinguishes it from the sibling 'fetch' tool for single URLs.

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?

The description implies use when multiple URLs need to be fetched efficiently via parallelism, but does not explicitly state when not to use or provide alternatives to the sibling 'fetch' tool.

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/alexyangjie/mcp-server-multi-fetch'

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