browser-tools-mcp icon indicating copy to clipboard operation
browser-tools-mcp copied to clipboard

feat: Add tool annotations for improved LLM tool understanding

Open bryankthompson opened this issue 11 months ago • 0 comments

Summary

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

Changes

  • Added readOnlyHint: true to read-only tools:
    • getConsoleLogs, getConsoleErrors, getNetworkErrors, getNetworkLogs
    • getSelectedElement
    • runAccessibilityAudit, runPerformanceAudit, runSEOAudit
    • runNextJSAudit, runDebuggerMode, runAuditMode, runBestPracticesAudit
  • Added destructiveHint: true to tools that modify state:
    • takeScreenshot (creates files)
    • wipeLogs (clears data)
  • Added title annotations for human-readable display
  • Bump MCP SDK dependency from ^1.4.1 to ^1.7.0 for annotation support

Why This Matters

Tool annotations provide semantic metadata that helps MCP clients:

  • Safety automation: Clients like Claude Code can auto-approve readOnlyHint: true tools without confirmation
  • UI/UX improvements: Clients can display appropriate warnings/icons for destructive operations
  • Tool discovery: Clients can filter/group tools by characteristics

Testing

  • [x] Server builds successfully (npm run build)
  • [x] Live verification: Started server and confirmed tools/list returns annotations for all 14 tools
  • [x] Annotation values match actual tool behavior (read-only vs destructive)

Verification Output

Total tools: 14

Tool Name                      Title                          ReadOnly   Destructive
--------------------------------------------------------------------------------
getConsoleLogs                 Get Console Logs               True       N/A       
getConsoleErrors               Get Console Errors             True       N/A       
getNetworkErrors               Get Network Errors             True       N/A       
getNetworkLogs                 Get Network Logs               True       N/A       
takeScreenshot                 Take Screenshot                N/A        True      
getSelectedElement             Get Selected Element           True       N/A       
wipeLogs                       Wipe Logs                      N/A        True      
runAccessibilityAudit          Run Accessibility Audit        True       N/A       
runPerformanceAudit            Run Performance Audit          True       N/A       
runSEOAudit                    Run SEO Audit                  True       N/A       
runNextJSAudit                 Run Next.js Audit              True       N/A       
runDebuggerMode                Run Debugger Mode              True       N/A       
runAuditMode                   Run Audit Mode                 True       N/A       
runBestPracticesAudit          Run Best Practices Audit       True       N/A

🤖 Generated with Claude Code

bryankthompson avatar Dec 23 '25 22:12 bryankthompson

Thanks for this — it shipped in 2.0.0, extended a little further than the PR: every tool now declares annotations and an MCP output schema, so read-only tools can be auto-approved by clients and results arrive structured rather than as prose. Closing because the rewrite means the diff no longer applies. Credited in the release notes.

tedjames avatar Aug 10 '26 17:08 tedjames