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