update: 更新MCP为0.29.0,并且调节对应的方法。
This commit is contained in:
@@ -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
|
||||
|
@@ -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=
|
||||
|
@@ -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 必须是字符串类型")
|
||||
|
@@ -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 必须是字符串类型")
|
||||
}
|
||||
|
@@ -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{
|
||||
|
Reference in New Issue
Block a user