Skip to content

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

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

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

Conversation

@bryankthompson
Copy link
Copy Markdown

Summary

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

Changes

  • Added readOnlyHint: true to 10 read-only tools:

    • plan_task - Generates planning prompts
    • analyze_task - Analyzes task complexity
    • reflect_task - Reviews completed tasks
    • list_tasks - Lists all tasks
    • verify_task - Verifies task completion
    • query_task - Queries tasks
    • get_task_detail - Gets task details
    • process_thought - Processes thought chains
    • init_project_rules - Generates project rules
    • research_mode - Generates research prompts
  • Added destructiveHint: true to 5 tools that modify data:

    • split_tasks - Creates subtasks in database
    • execute_task - Updates task status to in_progress
    • delete_task - Deletes tasks from database
    • clear_all_tasks - Clears all tasks (irreversible)
    • update_task - Updates task content
  • 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 for safer operation
  • Enables smarter UI/UX decisions based on tool characteristics

Testing

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

Before/After

Before:

{
  name: "delete_task",
  description: "...",
  inputSchema: {...}
  // No annotations
}

After:

{
  name: "delete_task",
  description: "...",
  inputSchema: {...},
  annotations: {
    title: "Delete Task",
    destructiveHint: true
  }
}

🤖 Generated with Claude Code

Add readOnlyHint and destructiveHint annotations to all 15 tools
to help LLMs better understand tool behavior and make safer decisions.

Changes:
- Added readOnlyHint: true to 10 read-only tools (plan_task, analyze_task,
  reflect_task, list_tasks, verify_task, query_task, get_task_detail,
  process_thought, init_project_rules, research_mode)
- Added destructiveHint: true to 5 tools that modify data (split_tasks,
  execute_task, delete_task, clear_all_tasks, update_task)
- 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