feat: Add tool annotations for improved LLM tool understanding#249
Conversation
Add destructiveHint and title annotations to all 26 chart generation tools to help LLMs better understand tool behavior and make safer decisions. Changes: - Added destructiveHint: true to all chart generation tools - Added title annotations for human-readable display All chart generation tools create visual outputs, which constitutes a write operation from the MCP client perspective. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary of ChangesHello @triepod-ai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant metadata enhancements for all 26 chart generation tools. By adding Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds title and destructiveHint annotations to all 26 chart generation tools, which is a valuable enhancement for improving how LLMs understand and use these tools. The implementation is correct and achieves the goal. My main feedback is regarding code duplication. The same annotations block is added to every tool definition. I've left a comment on src/charts/area.ts with a suggestion to refactor this into a shared utility function to improve long-term maintainability. This could be handled in a follow-up PR. Otherwise, the changes look good.
|
@triepod-ai why need to add |
Chart generation tools are read-only transformations that: - Transform data into visual output (SVG/PNG) - Don't modify external state, files, or resources - Are idempotent - same data produces same chart They should be marked as readOnlyHint: true, not destructiveHint: true, since they don't have destructive side effects. Co-Authored-By: Claude <noreply@anthropic.com>
|
Great question! You're right. I've updated the PR to use Thank you for the feedback! |
|
@triepod-ai help to fix the ci. |
Add annotations field to all 26 chart test fixtures to match the tool annotations added in the source files. This fixes the CI build failure where test assertions expected the old schema structure without annotations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Hi @hustcc, thanks for the feedback! I've pushed a fix that updates all 26 test fixture JSON files to include the The CI workflow is waiting for approval (first-time contributor from fork). Once approved, it should pass. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #249 +/- ##
==========================================
+ Coverage 79.97% 81.02% +1.05%
==========================================
Files 42 42
Lines 1878 1982 +104
Branches 31 31
==========================================
+ Hits 1502 1606 +104
Misses 374 374
Partials 2 2
🚀 New features to boost your workflow:
|
Summary
Adds MCP tool annotations (
destructiveHint,title) to all 26 chart generation tools to help LLMs better understand tool behavior and make safer decisions about tool execution.Changes
destructiveHint: trueto all 26 chart generation toolstitleannotations for human-readable display (e.g., "Generate Line Chart", "Generate Pie Chart")All chart tools are marked as destructive because they create/generate visual outputs, which constitutes a write operation from the MCP client's perspective.
Tools Annotated
Why This Matters
Testing
npm run build)tools/listreturns annotations for all 26 tools🤖 Generated with Claude Code