From c08d2a3cf6f0394ec9752143cbd053fd30290027 Mon Sep 17 00:00:00 2001 From: Jack Adamson Date: Fri, 22 Nov 2024 19:03:02 +0000 Subject: [PATCH] fix lint --- src/fetch/src/mcp_server_fetch/server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fetch/src/mcp_server_fetch/server.py b/src/fetch/src/mcp_server_fetch/server.py index afcf2ed8..055dfc4b 100644 --- a/src/fetch/src/mcp_server_fetch/server.py +++ b/src/fetch/src/mcp_server_fetch/server.py @@ -86,11 +86,12 @@ async def call_tool(name, arguments: dict) -> list[TextContent]: return [TextContent(type="text", text=f"Contents of {url}:\n{content}")] @server.get_prompt() - async def get_prompt(name, arguments: dict) -> GetPromptResult: - url = arguments.get("url") - if not url: + async def get_prompt(name: str, arguments: dict | None) -> GetPromptResult: + if not arguments or "url" not in arguments: raise McpError(INVALID_PARAMS, "URL is required") + url = arguments["url"] + try: content = await fetch_url(url) # TODO: after SDK bug is addressed, don't catch the exception