Skip to content

Commit d4c8835

Browse files
committed
fix:mcp tools 编译不通过的bug
1 parent 6323688 commit d4c8835

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/mcp/get_nickname.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/flipped-aurora/gin-vue-admin/server/global"
88
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
99
"github.com/mark3labs/mcp-go/mcp"
10+
"gorm.io/gorm"
1011
)
1112

1213
func init() {
@@ -38,7 +39,7 @@ func (t *GetNickname) Handle(ctx context.Context, request mcp.CallToolRequest) (
3839
}
3940

4041
// 2. 记录操作日志
41-
global.GVA_LOG.Info("getNickname工具被调用", "username", username)
42+
global.GVA_LOG.Info("getNickname工具被调用")
4243

4344
// 3. 优化查询,只选择需要的字段
4445
var user struct {
@@ -55,7 +56,7 @@ func (t *GetNickname) Handle(ctx context.Context, request mcp.CallToolRequest) (
5556
if errors.Is(err, gorm.ErrRecordNotFound) {
5657
return nil, errors.New("用户不存在")
5758
}
58-
global.GVA_LOG.Error("数据库查询错误", "error", err)
59+
global.GVA_LOG.Error("数据库查询错误")
5960
return nil, errors.New("系统错误,请稍后再试")
6061
}
6162

0 commit comments

Comments
 (0)