Skip to content

Conversation

@triepod-ai
Copy link

Summary

  • Add MCP tool annotations to all 6 tools per MCP specification
  • Annotations help AI assistants understand tool behavior and capabilities
  • Added ToolAnnotations interface and updated UnifiedTool interface

Changes

Infrastructure

  • Added ToolAnnotations interface to registry.ts with all MCP-spec fields
  • Extended UnifiedTool interface with optional annotations property
  • Updated getToolDefinitions() to include annotations in Tool output

Tools Annotated

Tool readOnlyHint openWorldHint idempotentHint
ask-gemini true true -
brainstorm true true -
Help true true -
ping true - true
fetch-chunk true - true
timeout-test true - -

All tools are read-only - they query external services or return cached data but don't modify state.

Test plan

  • TypeScript builds without errors
  • Annotations follow MCP spec naming conventions
  • Tools with external API access marked openWorldHint: true
  • Idempotent tools (ping, cache retrieval) marked idempotentHint: true

🤖 Generated with Claude Code

Add MCP tool annotations per specification to help AI assistants
understand tool behavior and capabilities.

Tools annotated:
- ask-gemini: readOnlyHint=true, openWorldHint=true (Gemini API)
- brainstorm: readOnlyHint=true, openWorldHint=true (Gemini API)
- Help: readOnlyHint=true, openWorldHint=true (runs gemini CLI)
- ping: readOnlyHint=true, idempotentHint=true (echo utility)
- fetch-chunk: readOnlyHint=true, idempotentHint=true (cache retrieval)
- timeout-test: readOnlyHint=true (test utility)

Changes:
- Added ToolAnnotations interface to registry.ts
- Extended UnifiedTool interface with optional annotations
- Updated getToolDefinitions() to include annotations in output
- Added annotations to all 6 tool definitions

Annotations follow MCP spec:
https://spec.modelcontextprotocol.io/specification/2025-03-26/server/tools/#annotations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 29, 2025 15:04
@gemini-code-assist
Copy link

Summary of Changes

Hello @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 integrates Model Context Protocol (MCP) tool annotations across all defined tools. The primary goal is to provide AI assistants with richer metadata about each tool's characteristics, such as whether it's read-only, interacts with external systems, or is idempotent. This enhancement improves the AI's ability to reason about and effectively utilize the available tools, leading to more accurate and reliable tool selection and execution.

Highlights

  • MCP Tool Annotations: Model Context Protocol (MCP) tool annotations have been added to all six existing tools to help AI assistants better understand their behavior and capabilities.
  • New Interface ToolAnnotations: A new TypeScript interface, ToolAnnotations, has been introduced in registry.ts to define the structure for these annotations, including fields like title, readOnlyHint, destructiveHint, idempotentHint, and openWorldHint.
  • Updated UnifiedTool Interface: The UnifiedTool interface has been extended to include an optional annotations property of type ToolAnnotations, allowing each tool to specify its MCP annotations.
  • Annotation Integration in getToolDefinitions(): The getToolDefinitions() function has been updated to correctly include the new annotations property in the output Tool definitions, ensuring they are exposed as part of the tool's metadata.
  • Tool-Specific Annotations: All tools (ask-gemini, brainstorm, Help, ping, fetch-chunk, timeout-test) have been updated with appropriate readOnlyHint, openWorldHint, and idempotentHint values based on their functionality, with all tools being marked as readOnlyHint: true.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds MCP (Model Context Protocol) tool annotations to all 6 tools in the codebase, following the MCP specification. The annotations provide metadata that helps AI assistants understand tool behavior and capabilities, specifically marking tools as read-only, idempotent, or open-world (interacting with external entities).

Key changes:

  • Added ToolAnnotations interface to define the structure of MCP annotations
  • Extended UnifiedTool interface to support optional annotations
  • Annotated all 6 tools with appropriate hints based on their behavior

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/tools/registry.ts Added ToolAnnotations interface with MCP spec fields and updated getToolDefinitions() to include annotations in tool output
src/tools/ask-gemini.tool.ts Added annotations marking the tool as read-only and open-world (external API access)
src/tools/brainstorm.tool.ts Added annotations marking the tool as read-only and open-world (external API access)
src/tools/simple-tools.ts Added annotations to both ping (read-only, idempotent) and help (read-only, open-world) tools
src/tools/fetch-chunk.tool.ts Added annotations marking the tool as read-only and idempotent (cache retrieval)
src/tools/timeout-test.tool.ts Added annotations marking the tool as read-only

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively adds MCP tool annotations to all six tools, enhancing their discoverability and usability for AI assistants. The changes are well-structured, with a new ToolAnnotations interface and updates to UnifiedTool and getToolDefinitions. The annotations applied to each tool appear correct and align with their functionalities. I have one suggestion in src/tools/registry.ts to make the code slightly more concise.

Comment on lines 58 to 69
const toolDef: Tool = {
name: tool.name,
description: tool.description,
inputSchema,
};

// Include annotations if defined
if (tool.annotations) {
toolDef.annotations = tool.annotations;
}

return toolDef;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For improved conciseness and readability, you can construct and return the tool definition object in a single statement. Since tool.annotations is already optional, you can assign it directly. If it's undefined, it will be handled correctly upon serialization (usually omitted from JSON output). This avoids the need for a temporary variable and a conditional block.

Suggested change
const toolDef: Tool = {
name: tool.name,
description: tool.description,
inputSchema,
};
// Include annotations if defined
if (tool.annotations) {
toolDef.annotations = tool.annotations;
}
return toolDef;
return {
name: tool.name,
description: tool.description,
inputSchema,
annotations: tool.annotations,
};

Address code review feedback from Gemini Code Assist:
- Replace conditional block with direct object return
- Leverages undefined values being omitted in JSON serialization
- Results in cleaner, more concise code

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@triepod-ai
Copy link
Author

Thanks for the review feedback! Great suggestion - I've applied the refactor to simplify the object construction:

return {
  name: tool.name,
  description: tool.description,
  inputSchema,
  annotations: tool.annotations,
};

This is cleaner and leverages undefined values being omitted during JSON serialization. Commit: debfa37

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