Skip to main content
Glama
ackness

Fetch JSONPath MCP

by ackness

batch-fetch-text

Retrieve text content from multiple URLs simultaneously using HTTP methods like GET, POST, PUT, or DELETE. Supports concurrent requests for improved performance and offers output formats including markdown, clean text, or raw HTML.

Instructions

Batch fetch raw text content from multiple URLs using various HTTP methods. Executes requests concurrently for better performance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestsYesArray of URLs (strings) or request objects

Implementation Reference

  • Handler logic in @server.call_tool() for 'batch-fetch-text': validates input, extracts output_format, calls batch_fetch_urls helper, and returns JSON serialized result.
    elif tool_name == "batch-fetch-text":
        requests = args.get("requests", [])
        if not isinstance(requests, list) or not requests:
            result = "Failed to call tool, error: Missing or empty 'requests' array"
        else:
            output_format = args.get("output_format", "markdown")
            response_result = await batch_fetch_urls(requests, as_json=False, output_format=output_format)
            result = json.dumps(response_result)
  • Input schema for 'batch-fetch-text' tool defining 'requests' as array of strings (URLs) or objects with url, method, data, headers, output_format.
    inputSchema={
        "type": "object",
        "properties": {
            "requests": {
                "type": "array",
                "description": "Array of URLs (strings) or request objects",
                "items": {
                    "oneOf": [
                        {"type": "string"},
                        {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "description": "The URL to get text content from",
                                },
                                "method": {
                                    "type": "string",
                                    "description": "HTTP method to use (GET, POST, PUT, DELETE, PATCH, etc.). Default is GET.",
                                    "default": "GET"
                                },
                                "data": {
                                    "type": ["object", "string", "null"],
                                    "description": "Request body data for POST/PUT/PATCH requests. Can be a JSON object or string.",
                                },
                                "headers": {
                                    "type": "object",
                                    "description": "Additional HTTP headers to include in the request",
                                    "additionalProperties": {"type": "string"}
                                },
                                "output_format": {
                                    "type": "string",
                                    "description": "Output format: 'markdown' (default), 'clean_text', or 'raw_html'.",
                                    "enum": ["markdown", "clean_text", "raw_html"],
                                    "default": "markdown"
                                }
                            },
                            "required": ["url"]
                        }
                    ]
                },
            },
        },
        "required": ["requests"],
    },
  • Registration of 'batch-fetch-text' tool in @server.list_tools() with name, description, and inputSchema.
    types.Tool(
        name="batch-fetch-text",
        description=(
            "Batch fetch raw text content from multiple URLs using various HTTP methods. "
            "Executes requests concurrently for better performance."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "requests": {
                    "type": "array",
                    "description": "Array of URLs (strings) or request objects",
                    "items": {
                        "oneOf": [
                            {"type": "string"},
                            {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "description": "The URL to get text content from",
                                    },
                                    "method": {
                                        "type": "string",
                                        "description": "HTTP method to use (GET, POST, PUT, DELETE, PATCH, etc.). Default is GET.",
                                        "default": "GET"
                                    },
                                    "data": {
                                        "type": ["object", "string", "null"],
                                        "description": "Request body data for POST/PUT/PATCH requests. Can be a JSON object or string.",
                                    },
                                    "headers": {
                                        "type": "object",
                                        "description": "Additional HTTP headers to include in the request",
                                        "additionalProperties": {"type": "string"}
                                    },
                                    "output_format": {
                                        "type": "string",
                                        "description": "Output format: 'markdown' (default), 'clean_text', or 'raw_html'.",
                                        "enum": ["markdown", "clean_text", "raw_html"],
                                        "default": "markdown"
                                    }
                                },
                                "required": ["url"]
                            }
                        ]
                    },
                },
            },
            "required": ["requests"],
        },
    ),
  • Core helper function implementing concurrent batch fetching of text contents from URLs or request objects, handling errors and returning list of results with success/content/error.
    async def batch_fetch_urls(requests: list[str | dict[str, Any]], as_json: bool = True, output_format: str = "markdown") -> list[dict[str, Any]]:
        """
        Batch fetch content from multiple URLs concurrently.
        
        Args:
            requests: List of URLs (strings) or request objects with url, method, data, headers, output_format
            as_json: If True, validates content as JSON; if False, returns text content
            output_format: Default output format - "markdown", "clean_text", or "raw_html" (can be overridden per request)
            
        Returns:
            List of dictionaries with 'url', 'success', 'content', and optional 'error' keys
        """
        async def fetch_single(request: str | dict[str, Any]) -> dict[str, Any]:
            try:
                if isinstance(request, str):
                    # Simple URL string
                    content = await fetch_url_content(request, as_json=as_json, output_format=output_format)
                    return {"url": request, "success": True, "content": content}
                else:
                    # Request object with additional parameters
                    url = request.get("url", "")
                    method = request.get("method", "GET")
                    data = request.get("data")
                    headers = request.get("headers")
                    request_output_format = request.get("output_format", output_format)
                    
                    content = await fetch_url_content(
                        url, as_json=as_json, method=method, data=data, headers=headers, 
                        output_format=request_output_format
                    )
                    return {"url": url, "success": True, "content": content}
            except Exception as e:
                url = request if isinstance(request, str) else request.get("url", "")
                return {"url": url, "success": False, "error": str(e)}
        
        tasks = [fetch_single(request) for request in requests]
        results = await asyncio.gather(*tasks)
        return list(results)
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: concurrent execution for performance and support for various HTTP methods beyond GET. However, it lacks details on error handling, rate limits, authentication needs, timeout behavior, or what 'raw text content' specifically entails (e.g., encoding, size limits).

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 with two sentences that are front-loaded and waste-free. The first sentence covers purpose and scope, while the second adds performance context, with every word earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (batch HTTP operations with multiple methods and output formats), no annotations, and no output schema, the description is incomplete. It doesn't explain return values, error formats, or important behavioral constraints like concurrency limits or timeouts, leaving significant gaps for an AI agent to use it correctly.

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%, providing detailed documentation for the single parameter 'requests' and its nested properties. The description adds minimal value beyond the schema, only implying that requests are executed concurrently. No additional parameter semantics are explained in the description.

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 the specific action ('batch fetch raw text content'), target resource ('from multiple URLs'), and method ('using various HTTP methods'). It distinguishes from sibling tools by specifying 'raw text content' rather than JSON, and mentions concurrent execution for performance.

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 usage context through 'batch fetch' and 'multiple URLs,' suggesting this is for bulk operations rather than single requests. However, it doesn't explicitly state when to use this tool versus alternatives like 'batch-fetch-json' or 'fetch-text,' nor does it mention any prerequisites or exclusions.

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/ackness/fetch-jsonpath-mcp'

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