CClaude Code Catalog
全スキル

MCP Tool Behavior 宣言

コーディング入門

2025-06-18仕様に基づきツール動作アノテーションを追加し、クライアントが確認ダイアログや自動承認を適切に処理できるようにします。

トリガー/mcp-tool-attr
使用頻度per tool

MCP Server Authorなら? Run /mcp-tool-attr to annotate all tools for safer client behavior

Security Engineerなら? Ensure destructive tools are properly flagged for UI gating

MCPTool Behavior安全性UX

動作フロー

/mcp-tool-attr [server-dir] run
Phase 1: scan and classify tools
tool-scan
List all registered tools
classify
Auto-classify read/write/destructive
annotate
Add behavior attributes
Generate behavior summary table
All tools annotated with behavior attributes

スキルコード

# MCP Tool Behavior Declarator ## Trigger: /mcp-tool-attr [server-directory] When invoked: 1. Scan tools and add behavior annotations: ```typescript server.tool("list-files", { description: "List files in a directory", annotations: { readOnlyHint: true, // Does not modify state destructiveHint: false, // Cannot destroy data idempotentHint: true, // Safe to retry openWorldHint: false, // No external side effects }, inputSchema: { /* ... */ } }, handler); server.tool("delete-record", { description: "Permanently delete a database record", annotations: { readOnlyHint: false, destructiveHint: true, // Irreversible action idempotentHint: true, // Deleting twice = same result openWorldHint: false, }, inputSchema: { /* ... */ } }, handler); server.tool("send-email", { description: "Send email to a recipient", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, // Sending twice = two emails openWorldHint: true, // External side effect (email sent) }, inputSchema: { /* ... */ } }, handler); ``` 2. Behavior classification guide: | Attribute | true | false | |-----------|------|-------| | readOnlyHint | Queries, listings, searches | Create, update, delete | | destructiveHint | Delete, drop, purge, overwrite | Create, read, append | | idempotentHint | GET-like, upsert, delete | POST-like, send, increment | | openWorldHint | Email, API call, webhook | Local DB, file system | 3. Client behavior expectations: - readOnly: may auto-approve without user confirmation - destructive: should show confirmation dialog - idempotent: safe to retry on network errors - openWorld: warn about external side effects

コピーしてCLAUDE.mdに貼り付ければ、すぐに使えます。

MCP Tool Behavior 宣言 の仕組み

MCP Tool Behavior Declaratorは、サーバーディレクトリのすべてのツールをスキャンし、readOnly、destructive、idempotent、openWorldの4つの動作属性を自動分類してannotationsオブジェクトに追加します。クライアントはこの属性に基づいて確認ダイアログの表示、自動承認、リトライ最適化などのUXを決定します。

MCP Tool Behavior 宣言 が力を発揮する場面

MCPサーバーに複数のツールがあり、それぞれの安全性レベルを明示的に宣言してクライアントに適切なUIゲーティングを適用させたいときに不可欠です。

主な強み

  • 4つの動作属性の自動分類
  • destructiveツールに確認ダイアログを自動適用
  • readOnlyツールはユーザー承認なしで自動実行可能
  • idempotent表示でネットワークエラー時の安全なリトライ

同じカテゴリのスキル

コーディング すべて見る

他カテゴリの人気スキル