Skip to content

feat(fetch): add tool annotations to server-fetch#3650

Open
jasonmatthewsuhari wants to merge 1 commit intomodelcontextprotocol:mainfrom
jasonmatthewsuhari:feat/fetch-tool-annotations
Open

feat(fetch): add tool annotations to server-fetch#3650
jasonmatthewsuhari wants to merge 1 commit intomodelcontextprotocol:mainfrom
jasonmatthewsuhari:feat/fetch-tool-annotations

Conversation

@jasonmatthewsuhari
Copy link

Closes #3572

Summary

Adds MCP tool annotations to the fetch tool, which currently has zero annotations despite the spec supporting them and server-filesystem already annotating all 14 of its tools.

Tool readOnlyHint destructiveHint idempotentHint openWorldHint
fetch true false true true

Rationale per annotation:

  • readOnlyHint: true — the tool performs an HTTP GET and returns content; it does not modify any data locally or on the target server
  • destructiveHint: false — no side effects
  • idempotentHint: true — fetching the same URL twice produces the same result (modulo server-side changes)
  • openWorldHint: true — the tool makes outbound HTTP requests to arbitrary URLs; this is the most safety-relevant annotation as it signals to clients that the tool can reach any internet host

No behaviour changes — annotations are hints only.

Changes

  • server.py: import ToolAnnotations, extract tool definition into _make_fetch_tool() helper, add the four annotations
  • tests/test_server.py: add TestListTools.test_fetch_tool_annotations asserting all four annotation values via _make_fetch_tool()

Test plan

  • All 21 existing tests pass (uv run pytest tests/ -v)
  • New annotation test passes

Adds MCP tool annotations to the fetch tool as requested in modelcontextprotocol#3572.
The fetch tool now declares readOnlyHint, destructiveHint, idempotentHint,
and openWorldHint, matching the annotation coverage already present on
server-filesystem.

Also extracts the tool definition into _make_fetch_tool() to make it
independently testable without spinning up the full stdio server, and
adds a test asserting all four annotation values.
@jasonmatthewsuhari
Copy link
Author

friendly ping, happy to address any feedback

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant