Skip to content

fix: add tool annotations to server-fetch - #3876

Open
Chelebii wants to merge 1 commit into
modelcontextprotocol:mainfrom
Chelebii:fix-3572-fetch-annotations
Open

fix: add tool annotations to server-fetch#3876
Chelebii wants to merge 1 commit into
modelcontextprotocol:mainfrom
Chelebii:fix-3572-fetch-annotations

Conversation

@Chelebii

@Chelebii Chelebii commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

This PR adds missing tool annotations (readOnlyHint, idempotentHint, openWorldHint) to the fetch tool in @modelcontextprotocol/server-fetch. This follows the pattern in other reference servers and provides better metadata for MCP clients. Fixes #3572.

@cliffhall cliffhall added enhancement New feature or request server-fetch Reference implementation for the Fetch MCP server - src/fetch labels Apr 20, 2026
@cliffhall

Copy link
Copy Markdown
Member

@claude review

@claude

claude Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Claude finished @cliffhall's task in 1m 36s —— View job


PR Review: fix: add tool annotations to server-fetch

  • Gather context
  • Read changed files and diff
  • Compare against other server patterns
  • Post review feedback

Summary

This is a clean, focused PR that adds ToolAnnotations to the fetch tool in server-fetch. The change is minimal (7 lines added, 0 deleted) and follows the established pattern in the codebase. Here's a detailed look:


What changed

src/fetch/src/mcp_server_fetch/server.py — two additions:

  1. Import of ToolAnnotations from mcp.types (line 17)
  2. Annotations block on the fetch tool definition (lines 207–212):
annotations=ToolAnnotations(
    readOnlyHint=True,
    destructiveHint=False,
    idempotentHint=True,
    openWorldHint=True,
),

Annotation value review

Annotation Value Assessment
readOnlyHint True ✅ Correct — fetch only reads web content, modifies no state
destructiveHint False ✅ Correct — not destructive
idempotentHint True ✅ Acceptable — no side effects; consistent with sequentialthinking pattern
openWorldHint True ✅ Correct — makes real network calls to external URLs

Minor observations

destructiveHint=False is technically redundant when readOnlyHint=True. Per the MCP spec, destructiveHint "only applies to tools that modify their environment; it has no meaning for read-only tools." That said, the sequentialthinking server (src/sequentialthinking/index.ts:96) uses the same explicit pattern, so this is consistent with project style — not a blocker.

idempotentHint=True with openWorldHint=True — these aren't contradictory. idempotentHint signals "no additional side effects from repeated calls", not "always returns the same result." Since fetch performs no state mutations, this is accurate.


Code quality

  • Import placement is correct — ToolAnnotations is added in the existing mcp.types import block in alphabetical order.
  • Pattern matches how the Python SDK is already used elsewhere in the project.
  • No tests are needed — this is pure metadata visible to MCP clients only.

Verdict

LGTM. The change is correct, minimal, and consistent with the existing codebase patterns. No functional or security concerns.

@LuuOW LuuOW left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technical audit: Verified MCP server implementation for consistency with current SDK patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request server-fetch Reference implementation for the Fetch MCP server - src/fetch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tool annotations to server-fetch (1 tool, 0 annotated)

3 participants