Skip to content

Commit 960321f

Browse files
committed
improve error message to model on fetch failure
1 parent 37622d3 commit 960321f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/fetch/src/mcp_server_fetch/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ async def fetch_url(url: str, user_agent: str) -> str:
9595
async with AsyncClient() as client:
9696
try:
9797
response = await client.get(
98-
url, follow_redirects=True, headers={"User-Agent": user_agent}
98+
url, follow_redirects=True, headers={"User-Agent": user_agent}, timeout=30,
9999
)
100-
except HTTPError:
101-
raise McpError(INTERNAL_ERROR, f"Failed to fetch {url}")
100+
except HTTPError as e:
101+
raise McpError(INTERNAL_ERROR, f"Failed to fetch {url}: {e!r}")
102102
if response.status_code >= 400:
103103
raise McpError(
104104
INTERNAL_ERROR,

0 commit comments

Comments
 (0)