feat(fetch): add tool annotations to server-fetch#3650
Open
jasonmatthewsuhari wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
feat(fetch): add tool annotations to server-fetch#3650jasonmatthewsuhari wants to merge 1 commit intomodelcontextprotocol:mainfrom
jasonmatthewsuhari wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
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.
Author
|
friendly ping, happy to address any feedback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)