browser-tools-mcp
browser-tools-mcp copied to clipboard
feat: Add tool annotations for improved LLM tool understanding
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: trueto read-only tools:getConsoleLogs,getConsoleErrors,getNetworkErrors,getNetworkLogsgetSelectedElementrunAccessibilityAudit,runPerformanceAudit,runSEOAuditrunNextJSAudit,runDebuggerMode,runAuditMode,runBestPracticesAudit
- Added
destructiveHint: trueto tools that modify state:takeScreenshot(creates files)wipeLogs(clears data)
- Added
titleannotations for human-readable display - Bump MCP SDK dependency from
^1.4.1to^1.7.0for annotation support
Why This Matters
Tool annotations provide semantic metadata that helps MCP clients:
- Safety automation: Clients like Claude Code can auto-approve
readOnlyHint: truetools 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/listreturns 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
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.