Skip to content

feat(mcp): annotate tools with read-only/destructive hints#126

Merged
hyldmo merged 1 commit into
mainfrom
hyldmo/mcp-tool-categories
May 11, 2026
Merged

feat(mcp): annotate tools with read-only/destructive hints#126
hyldmo merged 1 commit into
mainfrom
hyldmo/mcp-tool-categories

Conversation

@hyldmo
Copy link
Copy Markdown
Owner

@hyldmo hyldmo commented May 10, 2026

Summary

  • Derive MCP ToolAnnotations from each tRPC procedure's _def.type and method name so clients (Claude.ai connector UI, Cursor, etc.) can group/badge tools as read-only vs writes vs destructive.
  • Defaults: queryreadOnlyHint: true; mutationreadOnlyHint: false; delete*/remove* mutations → destructiveHint: true; openWorldHint: false (we only touch our own DB).
  • Per-procedure overrides via .meta({ readOnly, destructive, idempotent, openWorld }) for cases where the default is wrong.
  • No route files touched — every existing procedure already matches the defaults.
  • Bumps nursery.useSortedClasses from warnerror (fix already safe); auto-sorted one preexisting class list in BarcodeScanner.tsx.

Test plan

  • yarn check passes (lint + typecheck + test)
  • New unit tests cover defaults (query/mutation/delete) + meta overrides + a real-router spot-check (recipe_list read-only, recipe_delete destructive)
  • Manual verify: connect Claude.ai/Cursor to /api/mcp and confirm tools surface with category badges

🤖 Generated with Claude Code

Derive MCP tool annotations from tRPC procedure type (query → readOnly,
mutation → not) and method name (delete*/remove* → destructive), with
per-procedure overrides via .meta(). Lets MCP clients group/badge tools
by category instead of treating every tool the same.

Also bumps useSortedClasses from warn to error (fix already safe).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Preview deployment

URL https://hyldmo-mcp-tool-categories.macromaxxing.pages.dev
Branch hyldmo/mcp-tool-categories
Commit 0a3df9b

@hyldmo hyldmo merged commit a802547 into main May 11, 2026
3 checks passed
@hyldmo hyldmo deleted the hyldmo/mcp-tool-categories branch May 11, 2026 04:42
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.

1 participant