Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/fetch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The fetch tool will truncate the response, but by using the `start_index` argume
- `max_length` (integer, optional): Maximum number of characters to return (default: 5000)
- `start_index` (integer, optional): Start content from this character index (default: 0)
- `raw` (boolean, optional): Get raw content without markdown conversion (default: false)
- Annotations: `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: true` (it only reads, and it reaches arbitrary hosts on the internet)

### Prompts

Expand Down
10 changes: 10 additions & 0 deletions src/fetch/src/mcp_server_fetch/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
PromptMessage,
TextContent,
Tool,
ToolAnnotations,
INVALID_PARAMS,
INTERNAL_ERROR,
)
Expand Down Expand Up @@ -409,6 +410,15 @@ 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(),
# Reads only, changes nothing, and repeating a request has no
# further side effect; it reaches arbitrary hosts on the
# internet (#3572).
annotations=ToolAnnotations(
readOnlyHint=True,
destructiveHint=False,
idempotentHint=True,
openWorldHint=True,
),
)
]

Expand Down
7 changes: 7 additions & 0 deletions src/fetch/tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ async def test_list_tools_wire_shape(web: FakeWeb) -> None:
)
assert "this tool now grants you internet access" in tool["description"]
assert "outputSchema" not in tool
# #3572: the tool declares what it does, for clients' approval policies.
assert tool["annotations"] == {
"readOnlyHint": True,
"destructiveHint": False,
"idempotentHint": True,
"openWorldHint": True,
}
assert tool["inputSchema"] == {
"description": "Parameters for fetching a URL.",
"properties": {
Expand Down
Loading