Skip to content

feat: Add tool annotations for improved LLM tool understanding#61

Open
bryankthompson wants to merge 1 commit intonegokaz:mainfrom
bryankthompson:feat/add-tool-annotations
Open

feat: Add tool annotations for improved LLM tool understanding#61
bryankthompson wants to merge 1 commit intonegokaz:mainfrom
bryankthompson:feat/add-tool-annotations

Conversation

@bryankthompson
Copy link
Copy Markdown

Summary

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

Changes

  • Added readOnlyHint: true to read-only tools:

    • excel_read_sheet - Read Excel Sheet
    • excel_describe_sheets - Describe Excel Sheets
    • excel_screen_capture - Capture Excel Screenshot
  • Added destructiveHint: true to tools that modify data:

    • excel_write_to_sheet - Write to Excel Sheet
    • excel_copy_sheet - Copy Excel Sheet
    • excel_create_table - Create Excel Table
    • excel_format_range - Format Excel Range
  • Added title annotations for human-readable display

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, adding safety guardrails
  • Enables better UI/UX with appropriate warnings/icons based on tool characteristics

Testing

  • Project builds successfully (go build ./...)
  • No test failures
  • Annotations use standard mcp-go convenience functions (WithTitleAnnotation, WithReadOnlyHintAnnotation, WithDestructiveHintAnnotation)

Before/After

Before:

server.AddTool(mcp.NewTool("excel_read_sheet",
    mcp.WithDescription("Read values from Excel sheet..."),
    ...
), handler)

After:

server.AddTool(mcp.NewTool("excel_read_sheet",
    mcp.WithDescription("Read values from Excel sheet..."),
    mcp.WithTitleAnnotation("Read Excel Sheet"),
    mcp.WithReadOnlyHintAnnotation(true),
    ...
), handler)

🤖 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 readOnlyHint: true to read-only tools (read_sheet, describe_sheets, screen_capture)
- Added destructiveHint: true to tools that modify data (write_to_sheet, copy_sheet, create_table, format_range)
- Added title annotations for human-readable display

This improves tool safety metadata for MCP clients.

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