0908
This commit is contained in:
22
aio-mcp/internal/tools/system/ping.go
Normal file
22
aio-mcp/internal/tools/system/ping.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
)
|
||||
|
||||
// registerPing 注册 ping 工具:无参数健康检查,返回 pong 与服务器时间。
|
||||
func registerPing(s *mcp.Server) {
|
||||
mcp.AddTool(s, &mcp.Tool{
|
||||
Name: "ping",
|
||||
Description: "健康检查。返回 pong 与服务器当前时间,用于确认 aio-mcp 连接正常。",
|
||||
}, func(_ context.Context, _ *mcp.CallToolRequest, _ struct{}) (*mcp.CallToolResult, any, error) {
|
||||
return &mcp.CallToolResult{
|
||||
Content: []mcp.Content{
|
||||
&mcp.TextContent{Text: "pong " + time.Now().Format(time.RFC3339)},
|
||||
},
|
||||
}, nil, nil
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user