feat(fetch): add tool annotations to server-fetch - #3650
Conversation
Adds MCP tool annotations to the fetch tool as requested in #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.
|
friendly ping, happy to address any feedback |
|
@claude review |
|
Claude finished @cliffhall's task in 1m 17s —— View job PR Review: feat(fetch): add tool annotations to server-fetch
The intent here is correct and the implementation is clean. One spec-alignment issue worth addressing, plus a couple of minor notes. The spec issue: redundant hints when
|
LuuOW
left a comment
There was a problem hiding this comment.
Technical audit: Verified MCP server implementation for consistency with current SDK patterns.
Closes #3572
Summary
Adds MCP tool annotations to the
fetchtool, which currently has zero annotations despite the spec supporting them andserver-filesystemalready annotating all 14 of its tools.readOnlyHintdestructiveHintidempotentHintopenWorldHintfetchtruefalsetruetrueRationale per annotation:
readOnlyHint: true— the tool performs an HTTP GET and returns content; it does not modify any data locally or on the target serverdestructiveHint: false— no side effectsidempotentHint: 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 hostNo behaviour changes — annotations are hints only.
Changes
server.py: importToolAnnotations, extract tool definition into_make_fetch_tool()helper, add the four annotationstests/test_server.py: addTestListTools.test_fetch_tool_annotationsasserting all four annotation values via_make_fetch_tool()Test plan
uv run pytest tests/ -v)