feat: Add tool annotations for improved LLM tool understanding#73
Merged
jating06 merged 3 commits intoDec 30, 2025
Merged
Conversation
Add readOnlyHint and destructiveHint annotations to all 42 tools to help LLMs better understand tool behavior and make safer decisions. Changes: - Added SetReadOnly method to Tool interface for annotation support - Modified toolsets.RegisterTools to set annotations based on read/write classification - Read-only tools (25): readOnlyHint=true, destructiveHint=false - Destructive tools (17): readOnlyHint=false, destructiveHint=true This leverages the existing AddReadTools/AddWriteTools categorization to automatically apply correct annotations without modifying individual tool definitions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #73 +/- ##
==========================================
+ Coverage 94.38% 94.40% +0.01%
==========================================
Files 24 24
Lines 3511 3521 +10
==========================================
+ Hits 3314 3324 +10
Misses 134 134
Partials 63 63
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add test coverage for: - SetReadOnly method (true/false cases) - Tool annotation generation (readOnlyHint, destructiveHint branches) - Default annotation behavior This brings patch coverage above 90% threshold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
|
@triepod-ai please fix linting errors. Lint / lint (pull_request) |
Break long lines in tool_test.go to comply with 80-character limit: - Split handler function signatures across multiple lines - Wrap NewTool() calls - Split long comments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
Fixed! I've broken the long lines in the test file to comply with the 80-character limit. The push should trigger the CI to re-run. |
jating06
approved these changes
Dec 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds MCP tool annotations (
readOnlyHint,destructiveHint) to all 42 tools to help LLMs better understand tool behavior and make safer decisions about tool execution.Changes
SetReadOnlymethod to theToolinterface for annotation supporttoolsets.RegisterToolsto automatically set annotations based on read/write classificationreadOnlyHint: true,destructiveHint: false(all fetch_* operations)readOnlyHint: false,destructiveHint: true(create, update, capture, refund, etc.)This leverages your existing
AddReadTools/AddWriteToolscategorization to automatically apply correct annotations without modifying individual tool definitions.Why This Matters
Testing
go build ./...)go test ./...)tools/listreturns correct annotationsVerification Output
🤖 Generated with Claude Code