Skip to content

Conversation

@triepod-ai
Copy link

Summary

Adds MCP tool annotations (readOnlyHint, destructiveHint, openWorldHint, title) to all tools to help LLMs better understand tool behavior and make safer decisions about tool execution.

Changes

  • BaseTool class: Added annotations abstract property and updated register() to pass annotations to server.tool()
  • CreateUiTool: destructiveHint: true, openWorldHint: true (opens browser, creates/modifies files)
  • FetchUiTool: readOnlyHint: true, openWorldHint: true (read-only API call)
  • LogoSearchTool: destructiveHint: true, openWorldHint: true (writes to filesystem)
  • RefineUiTool: destructiveHint: true, openWorldHint: true (modifies existing components)
  • MCP SDK: Bumped from ^1.8.0 to ^1.25.1 for annotation support

Why This Matters

  • Annotations provide semantic metadata that helps LLMs understand tool behavior
  • LLMs can make better decisions about when to use tools and in what order
  • Enables safer tool execution by distinguishing read-only from destructive operations
  • openWorldHint indicates tools interact with external services (21st.dev, SVGL API)

Testing

  • Server builds successfully (npm run build)
  • Tests pass (npm run test)
  • tools/list returns annotations in response
  • Annotation values match actual tool behavior

Before/After

Before:

{
  "name": "21st_magic_component_inspiration",
  "description": "...",
  "inputSchema": {...}
}

After:

{
  "name": "21st_magic_component_inspiration",
  "description": "...",
  "inputSchema": {...},
  "annotations": {
    "title": "Fetch UI Inspiration",
    "readOnlyHint": 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 ToolAnnotations import from MCP SDK types
- Modified BaseTool class to support annotations property
- Added destructiveHint: true to CreateUiTool (creates/modifies files)
- Added readOnlyHint: true to FetchUiTool (read-only API call)
- Added destructiveHint: true to LogoSearchTool (writes to filesystem)
- Added destructiveHint: true to RefineUiTool (modifies components)
- Added openWorldHint: true to all tools (interact with external APIs)
- Added title annotations for human-readable display
- Bump MCP SDK from ^1.8.0 to ^1.25.1 for annotation support

This improves tool safety metadata for MCP clients.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@triepod-ai triepod-ai force-pushed the feat/add-tool-annotations branch from 354b33d to 9a83712 Compare January 6, 2026 14:45
@triepod-ai
Copy link
Author

Friendly ping! 👋 Just checking if this PR is still on your radar. Happy to address any feedback or make adjustments if needed. No rush - just wanted to make sure it didn't slip through the cracks.

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