From 0ebb3d4195da594e9787abe6a2bbe509f7f90226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?piexlMax=28=E5=A5=87=E6=B7=BC?= Date: Thu, 22 May 2025 16:10:47 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0MCP=E4=B8=BA0.29.0?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=B8=94=E8=B0=83=E8=8A=82=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/go.mod | 2 +- server/go.sum | 1 + server/mcp/current_time.go | 2 +- server/mcp/get_nickname.go | 2 +- server/resource/mcp/tools.tpl | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/go.mod b/server/go.mod index b70c6f56..68d6b890 100644 --- a/server/go.mod +++ b/server/go.mod @@ -113,7 +113,7 @@ require ( github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect github.com/magiconair/properties v1.8.9 // indirect github.com/mailru/easyjson v0.9.0 // indirect - github.com/mark3labs/mcp-go v0.26.0 // indirect + github.com/mark3labs/mcp-go v0.29.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/microsoft/go-mssqldb v1.8.0 // indirect github.com/minio/md5-simd v1.1.2 // indirect diff --git a/server/go.sum b/server/go.sum index dba8883f..a4dd658a 100644 --- a/server/go.sum +++ b/server/go.sum @@ -314,6 +314,7 @@ github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4 github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mark3labs/mcp-go v0.26.0 h1:xz/Kv1cHLYovF8txv6btBM39/88q3YOjnxqhi51jB0w= github.com/mark3labs/mcp-go v0.26.0/go.mod h1:rXqOudj/djTORU/ThxYx8fqEVj/5pvTuuebQ2RC7uk4= +github.com/mark3labs/mcp-go v0.29.0/go.mod h1:rXqOudj/djTORU/ThxYx8fqEVj/5pvTuuebQ2RC7uk4= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= diff --git a/server/mcp/current_time.go b/server/mcp/current_time.go index 72dc74e9..41eaea30 100644 --- a/server/mcp/current_time.go +++ b/server/mcp/current_time.go @@ -19,7 +19,7 @@ type CurrentTime struct { func (t *CurrentTime) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { // 获取当前系统时间 - timezone, ok := request.Params.Arguments["timezone"].(string) + timezone, ok := request.GetArguments()["timezone"].(string) if !ok { return nil, errors.New("参数错误:timezone 必须是字符串类型") diff --git a/server/mcp/get_nickname.go b/server/mcp/get_nickname.go index b1af73e1..6ad55f6a 100644 --- a/server/mcp/get_nickname.go +++ b/server/mcp/get_nickname.go @@ -29,7 +29,7 @@ func (t *GetNickname) New() mcp.Tool { // Handle 处理获取昵称的请求 func (t *GetNickname) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { // 1. 参数验证 - username, ok := request.Params.Arguments["username"].(string) + username, ok := request.GetArguments()["username"].(string) if !ok { return nil, errors.New("参数错误:username 必须是字符串类型") } diff --git a/server/resource/mcp/tools.tpl b/server/resource/mcp/tools.tpl index 6be9ef32..49bfa20b 100644 --- a/server/resource/mcp/tools.tpl +++ b/server/resource/mcp/tools.tpl @@ -17,7 +17,7 @@ func (t *{{.Name | title}}) Handle(ctx context.Context, request mcp.CallToolRequ // TODO: 实现工具逻辑 // 参数示例: // {{- range .Params}} - // {{.Name}} := request.Params.Arguments["{{.Name}}"] + // {{.Name}} := request.GetArguments()["{{.Name}}"] // {{- end}} return &mcp.CallToolResult{ Content: []mcp.Content{