From b641406b9fe12a2b193b90b4eefd43550d57a350 Mon Sep 17 00:00:00 2001 From: Piyush Jagadish Bag Date: Sun, 28 Jun 2026 03:07:03 -0700 Subject: [PATCH] feat(fetch): add tool annotations for fetch tool Set readOnlyHint, idempotentHint, destructiveHint, and openWorldHint on the fetch tool registration, matching the spec in #3572 and the pattern used by git and time reference servers. Document the annotations in the fetch README. Fixes #3572 --- src/fetch/README.md | 11 +++++++++++ src/fetch/src/mcp_server_fetch/server.py | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/src/fetch/README.md b/src/fetch/README.md index 2c3e048927..56becef779 100644 --- a/src/fetch/README.md +++ b/src/fetch/README.md @@ -9,6 +9,17 @@ A Model Context Protocol server that provides web content fetching capabilities. The fetch tool will truncate the response, but by using the `start_index` argument, you can specify where to start the content extraction. This lets models read a webpage in chunks, until they find the information they need. +### Tool annotations + +This server sets [MCP ToolAnnotations](https://modelcontextprotocol.io/specification/2025-03-26/server/tools#toolannotations) +on its tool so clients can apply safety policies (for example, gating outbound network access). + +| Tool | readOnlyHint | idempotentHint | destructiveHint | openWorldHint | +|--------|--------------|----------------|-----------------|---------------| +| fetch | true | true | false | true | + +The `openWorldHint: true` annotation reflects that `fetch` performs outbound HTTP requests to user-supplied URLs. + ### Available Tools - `fetch` - Fetches a URL from the internet and extracts its contents as markdown. diff --git a/src/fetch/src/mcp_server_fetch/server.py b/src/fetch/src/mcp_server_fetch/server.py index b42c7b1f6b..92e23fe231 100644 --- a/src/fetch/src/mcp_server_fetch/server.py +++ b/src/fetch/src/mcp_server_fetch/server.py @@ -14,6 +14,7 @@ PromptMessage, TextContent, Tool, + ToolAnnotations, INVALID_PARAMS, INTERNAL_ERROR, ) @@ -203,6 +204,12 @@ async def list_tools() -> list[Tool]: Although originally you did not have internet access, and were advised to refuse and tell the user this, this tool now grants you internet access. Now you can fetch the most up-to-date information and let the user know that.""", inputSchema=Fetch.model_json_schema(), + annotations=ToolAnnotations( + readOnlyHint=True, + destructiveHint=False, + idempotentHint=True, + openWorldHint=True, + ), ) ]