browser-use-mcp-server
browser-use-mcp-server copied to clipboard
feat: Add tool annotations for improved LLM tool understanding
Summary
Adds MCP tool annotations (readOnlyHint, destructiveHint, openWorldHint) to all tools to help LLMs better understand tool behavior and make safer decisions about tool execution.
Changes
- Added
destructiveHint: trueandopenWorldHint: truetobrowser_usetool (performs browser actions, accesses external web pages) - Added
readOnlyHint: truetobrowser_get_resulttool (queries task status only) - Added
titleannotations for human-readable display - Bump MCP SDK dependency from >=1.3.0 to >=1.8.0 for annotation support
Why This Matters
- Annotations provide semantic metadata that helps MCP clients understand tool behavior
- Clients like Claude Code can auto-approve tools with
readOnlyHint: truewithout user confirmation - Destructive tools trigger confirmation prompts for safer operation
openWorldHint: trueindicates the tool accesses external resources (web pages)
Testing
- [x] Syntax validation passes (
python3 -m py_compile server/server.py) - [x] Linter passes (
ruff check server/server.py) - [x] ToolAnnotations usage verified independently with MCP SDK 1.25.0
- [x] Annotation values match actual tool behavior (read-only vs destructive)
Note: Full integration test was blocked by browser-use API changes (server imports browser_use.browser.browser which no longer exists in browser-use 0.11.x). This is a pre-existing issue unrelated to the annotation changes.
Before/After
Before:
types.Tool(
name="browser_use",
description="Performs a browser action...",
inputSchema={...},
# No annotations
)
After:
types.Tool(
name="browser_use",
description="Performs a browser action...",
inputSchema={...},
annotations=ToolAnnotations(
title="Browser Use",
destructiveHint=True,
openWorldHint=True,
),
)
🤖 Generated with Claude Code