Glama
Chat
MCP
Gateway
Models
Pricing
Community
Sign In
Chat
MCP
Gateway
Models
Pricing
Community
Sign In
Glama
MCP
Servers
MCP Development Framework
Claim
by
aigo666
GitHub
Browser Automation
File Systems
Python
MIT License
2
Linux
Apple
Reddit
Discord
Overview
Inspect
Schema
Related Servers
Reviews
Score
Need Help?
View Source Code
Report Issue
.lh
mcp_simple_tool
tools
.lh/mcp_simple_tool/tools/utils
.lh/mcp_simple_tool/tools/base.py.json
.lh/mcp_simple_tool/tools/image_recognition_tool.py.json
.lh/mcp_simple_tool/tools/__init__.py.json
.lh/mcp_simple_tool/tools/loader.py.json
.lh/mcp_simple_tool/tools/pdf_tool.py.json
.lh/mcp_simple_tool/tools/quick_pdf_tool.py.json
.lh/mcp_simple_tool/tools/README.md.json
.lh/mcp_simple_tool/tools/url_tool.py.json
.lh/mcp_simple_tool/tools/web_tool.py.json
.lh/mcp_simple_tool/tools/word_tool.py.json
{ "sourceFile": "mcp_simple_tool/tools/url_tool.py", "activeCommit": 0, "commits": [ { "activePatchIndex": 0, "patches": [ { "date": 1741333258090, "content": "Index: \n===================================================================\n--- \n+++ \n" } ], "date": 1741333258090, "name": "Commit-0", "content": "import httpx\nimport mcp.types as types\nfrom . import BaseTool, ToolRegistry\n\n@ToolRegistry.register\nclass UrlTool(BaseTool):\n \"\"\"URL获取工具,用于获取网站内容\"\"\"\n name = \"url\"\n description = \"Fetches a website and returns its content\"\n input_schema = {\n \"type\": \"object\",\n \"required\": [\"url\"],\n \"properties\": {\n \"url\": {\n \"type\": \"string\",\n \"description\": \"URL to fetch\",\n }\n },\n }\n \n async def execute(self, arguments: dict) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:\n \"\"\"获取网站内容\"\"\"\n if \"url\" not in arguments:\n return [types.TextContent(\n type=\"text\",\n text=\"Error: Missing required argument 'url'\"\n )]\n \n url = arguments[\"url\"]\n headers = {\n \"User-Agent\": \"MCP Test Server (github.com/modelcontextprotocol/python-sdk)\"\n }\n try:\n timeout = httpx.Timeout(10.0, connect=5.0)\n async with httpx.AsyncClient(\n follow_redirects=True, \n headers=headers,\n timeout=timeout\n ) as client:\n response = await client.get(url)\n response.raise_for_status()\n return [types.TextContent(type=\"text\", text=response.text)]\n except httpx.TimeoutException:\n return [types.TextContent(\n type=\"text\",\n text=\"Error: Request timed out while trying to fetch the website.\"\n )]\n except httpx.HTTPStatusError as e:\n return [types.TextContent(\n type=\"text\",\n text=(f\"Error: HTTP {e.response.status_code} \"\n \"error while fetching the website.\")\n )]\n except Exception as e:\n return [types.TextContent(\n type=\"text\",\n text=f\"Error: Failed to fetch website: {str(e)}\"\n )] " } ] }