update: 更新MCP为0.29.0,并且调节对应的方法。

This commit is contained in:
piexlMax(奇淼
2025-05-22 16:10:47 +08:00
parent e7680c43ac
commit 0ebb3d4195
5 changed files with 5 additions and 4 deletions

View File

@@ -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

View File

@@ -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=

View File

@@ -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 必须是字符串类型")

View File

@@ -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 必须是字符串类型")
}

View File

@@ -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{