From 72b974abf04b4b782ee0982961985a6bf2bb39b1 Mon Sep 17 00:00:00 2001 From: triepod-ai Date: Sat, 27 Dec 2025 10:58:04 -0600 Subject: [PATCH] feat: Add MCP tool annotations for improved LLM understanding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add tool annotations (title, readOnlyHint, destructiveHint) to all 6 MCP tools: Read-only tools (4): - definition: Go to Definition - references: Find References - diagnostics: Get Diagnostics - hover: Hover Information Destructive tools (2): - edit_file: Edit File - rename_symbol: Rename Symbol These annotations help LLMs and clients understand tool behavior and make safer tool selection decisions. Requires mcp-go v0.28.0+ for annotation support. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- go.mod | 2 +- go.sum | 4 ++-- tools.go | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b875a3fc..da671104 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.24.0 require ( github.com/davecgh/go-spew v1.1.1 github.com/fsnotify/fsnotify v1.9.0 - github.com/mark3labs/mcp-go v0.25.0 + github.com/mark3labs/mcp-go v0.28.0 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/stretchr/testify v1.10.0 golang.org/x/text v0.25.0 diff --git a/go.sum b/go.sum index 9ae54052..5a38755a 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mark3labs/mcp-go v0.25.0 h1:UUpcMT3L5hIhuDy7aifj4Bphw4Pfx1Rf8mzMXDe8RQw= -github.com/mark3labs/mcp-go v0.25.0/go.mod h1:rXqOudj/djTORU/ThxYx8fqEVj/5pvTuuebQ2RC7uk4= +github.com/mark3labs/mcp-go v0.28.0 h1:7yl4y5D1KYU2f/9Uxp7xfLIggfunHoESCRbrjcytcLM= +github.com/mark3labs/mcp-go v0.28.0/go.mod h1:rXqOudj/djTORU/ThxYx8fqEVj/5pvTuuebQ2RC7uk4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= diff --git a/tools.go b/tools.go index 55898caf..5b87c7ca 100644 --- a/tools.go +++ b/tools.go @@ -13,6 +13,8 @@ func (s *mcpServer) registerTools() error { applyTextEditTool := mcp.NewTool("edit_file", mcp.WithDescription("Apply multiple text edits to a file."), + mcp.WithTitleAnnotation("Edit File"), + mcp.WithDestructiveHintAnnotation(true), mcp.WithArray("edits", mcp.Required(), mcp.Description("List of edits to apply"), @@ -97,6 +99,8 @@ func (s *mcpServer) registerTools() error { readDefinitionTool := mcp.NewTool("definition", mcp.WithDescription("Read the source code definition of a symbol (function, type, constant, etc.) from the codebase. Returns the complete implementation code where the symbol is defined."), + mcp.WithTitleAnnotation("Go to Definition"), + mcp.WithReadOnlyHintAnnotation(true), mcp.WithString("symbolName", mcp.Required(), mcp.Description("The name of the symbol whose definition you want to find (e.g. 'mypackage.MyFunction', 'MyType.MyMethod')"), @@ -121,6 +125,8 @@ func (s *mcpServer) registerTools() error { findReferencesTool := mcp.NewTool("references", mcp.WithDescription("Find all usages and references of a symbol throughout the codebase. Returns a list of all files and locations where the symbol appears."), + mcp.WithTitleAnnotation("Find References"), + mcp.WithReadOnlyHintAnnotation(true), mcp.WithString("symbolName", mcp.Required(), mcp.Description("The name of the symbol to search for (e.g. 'mypackage.MyFunction', 'MyType')"), @@ -145,6 +151,8 @@ func (s *mcpServer) registerTools() error { getDiagnosticsTool := mcp.NewTool("diagnostics", mcp.WithDescription("Get diagnostic information for a specific file from the language server."), + mcp.WithTitleAnnotation("Get Diagnostics"), + mcp.WithReadOnlyHintAnnotation(true), mcp.WithString("filePath", mcp.Required(), mcp.Description("The path to the file to get diagnostics for"), @@ -252,6 +260,8 @@ func (s *mcpServer) registerTools() error { hoverTool := mcp.NewTool("hover", mcp.WithDescription("Get hover information (type, documentation) for a symbol at the specified position."), + mcp.WithTitleAnnotation("Hover Information"), + mcp.WithReadOnlyHintAnnotation(true), mcp.WithString("filePath", mcp.Required(), mcp.Description("The path to the file to get hover information for"), @@ -304,6 +314,8 @@ func (s *mcpServer) registerTools() error { renameSymbolTool := mcp.NewTool("rename_symbol", mcp.WithDescription("Rename a symbol (variable, function, class, etc.) at the specified position and update all references throughout the codebase."), + mcp.WithTitleAnnotation("Rename Symbol"), + mcp.WithDestructiveHintAnnotation(true), mcp.WithString("filePath", mcp.Required(), mcp.Description("The path to the file containing the symbol to rename"),