Skip to main content
Glama
aigo666

MCP Development Framework

url

Fetch website content from any URL to retrieve and analyze web data directly within your development environment.

Instructions

Fetches a website and returns its content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to fetch

Implementation Reference

  • The async execute method that handles URL fetching using httpx.AsyncClient, with timeout, redirects, custom User-Agent, and error handling for missing args, timeouts, HTTP errors, and exceptions.
    async def execute(self, arguments: dict) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """获取网站内容"""
        if "url" not in arguments:
            return [types.TextContent(
                type="text",
                text="Error: Missing required argument 'url'"
            )]
            
        url = arguments["url"]
        headers = {
            "User-Agent": "MCP Test Server (github.com/modelcontextprotocol/python-sdk)"
        }
        try:
            timeout = httpx.Timeout(10.0, connect=5.0)
            async with httpx.AsyncClient(
                follow_redirects=True, 
                headers=headers,
                timeout=timeout
            ) as client:
                response = await client.get(url)
                response.raise_for_status()
                return [types.TextContent(type="text", text=response.text)]
        except httpx.TimeoutException:
            return [types.TextContent(
                type="text",
                text="Error: Request timed out while trying to fetch the website."
            )]
        except httpx.HTTPStatusError as e:
            return [types.TextContent(
                type="text",
                text=(f"Error: HTTP {e.response.status_code} "
                      "error while fetching the website.")
            )]
        except Exception as e:
            return [types.TextContent(
                type="text",
                text=f"Error: Failed to fetch website: {str(e)}"
            )] 
  • The input_schema defining the tool's input as an object requiring a 'url' string parameter.
    input_schema = {
        "type": "object",
        "required": ["url"],
        "properties": {
            "url": {
                "type": "string",
                "description": "URL to fetch",
            }
        },
    }
  • Registration via @ToolRegistry.register decorator on UrlTool class, setting name='url' and description.
    @ToolRegistry.register
    class UrlTool(BaseTool):
        """URL获取工具,用于获取网站内容"""
        name = "url"
        description = "Fetches a website and returns its content"
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('fetches') and outcome ('returns its content'), but lacks critical details such as authentication requirements, rate limits, error handling, content type support (e.g., HTML, text), or whether it follows redirects. This leaves significant gaps for an AI agent to understand the tool's behavior.

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 and front-loaded, consisting of a single, clear sentence that directly states the tool's function. There is no wasted language or unnecessary elaboration, making it efficient for quick understanding.

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

Completeness2/5

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

Given the tool's complexity (a network fetch operation), lack of annotations, and absence of an output schema, the description is incomplete. It doesn't cover important aspects like response format, error conditions, or behavioral traits (e.g., timeouts, headers), which are crucial for proper tool invocation in this context.

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?

The input schema has 100% description coverage, with the single parameter 'url' clearly documented as 'URL to fetch'. The description adds no additional semantic meaning beyond this, such as URL format constraints or protocol support. According to the rules, with high schema coverage, the baseline is 3 when no extra param info is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('fetches') and resource ('a website'), and indicates the outcome ('returns its content'). However, it doesn't explicitly differentiate this tool from potential sibling tools that might also fetch content from different sources or in different ways, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any context-specific conditions, prerequisites, or exclusions, nor does it reference sibling tools like 'parse_file' or 'parse_pdf' that might handle similar content-fetching tasks from different sources.

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/aigo666/mcp-framework'

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