Skip to content

Conversation

@triepod-ai
Copy link

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: true and openWorldHint: true to browser_use tool (performs browser actions, accesses external web pages)
  • Added readOnlyHint: true to browser_get_result tool (queries task status only)
  • Added title annotations 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: true without user confirmation
  • Destructive tools trigger confirmation prompts for safer operation
  • openWorldHint: true indicates the tool accesses external resources (web pages)

Testing

  • Syntax validation passes (python3 -m py_compile server/server.py)
  • Linter passes (ruff check server/server.py)
  • ToolAnnotations usage verified independently with MCP SDK 1.25.0
  • 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

Add readOnlyHint and destructiveHint annotations to all tools
to help LLMs better understand tool behavior and make safer decisions.

Changes:
- Added destructiveHint and openWorldHint to browser_use tool (performs browser actions)
- Added readOnlyHint to browser_get_result tool (retrieves task status)
- Added title annotations for human-readable display
- Bump MCP SDK from >=1.3.0 to >=1.8.0 for annotation support

This improves tool safety metadata for MCP clients.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants