feat: Add MCP tool annotations for all 6 tools - #107
Open
bryankthompson wants to merge 1 commit into
Open
Conversation
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 <noreply@anthropic.com>
bryankthompson
force-pushed
the
feat/add-tool-annotations
branch
from
December 27, 2025 16:58
ce8b151 to
72b974a
Compare
STRd6
pushed a commit
to STRd6/mcp-language-server
that referenced
this pull request
May 14, 2026
Adds MCP tool annotations introduced in mcp-go v0.28: a human-readable title plus ReadOnlyHint for the six read-only tools (definition, references, hover, diagnostics, document_symbols, code_actions, semantic_tokens) and DestructiveHint for the two that modify the workspace (edit_file, rename_symbol, format_document). Clients use these to gate auto-approval and surface clearer labels. Adapted from upstream PR isaacphi#107 (bryankthompson) and extended to cover the four extra tools this fork registers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
judggernaut
added a commit
to judggernaut/mcp-language-server
that referenced
this pull request
Jul 3, 2026
Upstream PR isaacphi#107 (isaacphi/mcp-language-server). Every tool previously relied on the MCP SDK's default annotations, which mark everything as potentially destructive. That meant read-only tools (definition, references, diagnostics, hover) were indistinguishable from actual mutating tools (edit_file, rename_symbol) to any client that uses these hints to decide whether a tool call needs extra caution or confirmation. Add a title and ReadOnlyHint(true) to the four read-only tools, and a title and DestructiveHint(true) to the two mutating ones. Requires bumping mark3labs/mcp-go from v0.25.0 to v0.28.0 for the annotation helper functions; kept to v0.28.0 rather than the current latest because later versions require Go >= 1.25.5 while this repo's CI is pinned to Go 1.24. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Add MCP tool annotations to all 6 tools to improve LLM tool selection and user experience.
Read-only tools (4):
definitionReadOnlyHint: truereferencesReadOnlyHint: truediagnosticsReadOnlyHint: truehoverReadOnlyHint: trueDestructive tools (2):
edit_fileDestructiveHint: truerename_symbolDestructiveHint: trueChanges
mcp.WithToolAnnotation()to all 6 tool definitions intools.gomcp-gofrom v0.25.0 to v0.26.0 for annotation supportBenefits
Tool annotations help MCP clients (like Claude Desktop):
References
🤖 Generated with Claude Code