Refactor routes and harden AddTool (#5375)

This commit is contained in:
mk0walsk
2026-01-24 14:13:35 +02:00
committed by GitHub
parent 173f76acf9
commit 94e2f5bd12
3 changed files with 30 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
sdkmcp "github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/zeromicro/go-zero/core/logx"
)
// Re-export commonly used SDK types for convenience
@@ -93,5 +94,7 @@ func AddTool[In, Out any](server McpServer, tool *Tool, handler func(context.Con
// Access internal server - only works with mcpServerImpl
if impl, ok := server.(*mcpServerImpl); ok {
sdkmcp.AddTool(impl.mcpServer, tool, handler)
} else {
logx.Error("AddTool: server must be of type *mcpServerImpl to use this helper")
}
}