feat: Add tool annotations to scaffolding templates#111
Merged
jmhbh merged 2 commits intokagent-dev:mainfrom Feb 3, 2026
Merged
feat: Add tool annotations to scaffolding templates#111jmhbh merged 2 commits intokagent-dev:mainfrom
jmhbh merged 2 commits intokagent-dev:mainfrom
Conversation
EItanya
reviewed
Feb 2, 2026
Contributor
EItanya
left a comment
There was a problem hiding this comment.
These changes make sense to me. Can you sign the commits as per the DCO requirement
Add MCP tool annotations support to all framework templates (Go, TypeScript, Python, Java) to help LLMs better understand tool behavior. Changes by framework: **Go (modelcontextprotocol/go-sdk):** - Bump SDK from v0.2.0 to v1.2.0 for annotation support - Add Annotations field to MCPTool struct - Add annotations to echo.go.tmpl and tool.go.tmpl **TypeScript (@modelcontextprotocol/sdk):** - Import ToolAnnotations type - Add annotations field to Tool interface - Add annotations to echo.ts.tmpl and tool.ts.tmpl - Include annotations in tools/list response **Python (FastMCP):** - Import ToolAnnotations from mcp.types - Add annotations parameter to @mcp.tool() decorator - Add annotations to echo.py.tmpl and tool.py.tmpl **Java (io.modelcontextprotocol.sdk):** - Add getAnnotations() method to Tool interface - Add annotations to Echo.java.tmpl and ToolTemplate.java.tmpl - Update MCPServer to include annotations in both stdio and HTTP responses This change benefits all users who scaffold new MCP servers with kmcp, ensuring their generated projects include proper tool annotations from the start. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: bryankthompson <199543909+bryankthompson@users.noreply.github.com>
The Go SDK v1.2.0 has a completely different API compared to v0.2.0 that the templates were designed for. The migration requires updating all Go templates including main.go, not just the tool files. This reverts the Go-specific changes while keeping annotations for: - TypeScript (@modelcontextprotocol/sdk) - Python (FastMCP with mcp.types.ToolAnnotations) - Java (io.modelcontextprotocol.sdk) The Go templates will need a separate PR to migrate to the v1.2.0 API before annotations can be added. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: bryankthompson <199543909+bryankthompson@users.noreply.github.com>
01119b9 to
502901f
Compare
Contributor
Author
|
Done! I've rebased on the latest main and added DCO sign-off to both commits. The DCO check should pass now. Thank you for the review! |
jmhbh
approved these changes
Feb 3, 2026
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 support to all framework templates (Go, TypeScript, Python, Java) to help LLMs better understand tool behavior and make safer decisions about tool execution.
Changes
Go (modelcontextprotocol/go-sdk)
Annotationsfield toMCPToolstructecho.go.tmplandtool.go.tmplTypeScript (@modelcontextprotocol/sdk)
ToolAnnotationstypeannotationsfield toToolinterfaceecho.ts.tmplandtool.ts.tmpltools/listresponsePython (FastMCP)
ToolAnnotationsfrommcp.typesannotationsparameter to@mcp.tool()decoratorecho.py.tmplandtool.py.tmplJava (io.modelcontextprotocol.sdk)
getAnnotations()method toToolinterfaceEcho.java.tmplandToolTemplate.java.tmplMCPServerto include annotations in both stdio and HTTP responsesWhy This Matters
Tool annotations are part of the MCP specification that enable:
This change benefits all users who scaffold new MCP servers with kmcp, ensuring their generated projects include proper tool annotations from the start.
Testing
make lintpassesmake testpassesBefore/After
Before (generated tool):
After (generated tool):
References