Skip to main content
Glama

DiceDB MCP

by pottekkat
MIT License
5
  • Linux
  • Apple
ping.go1.02 kB
package tools import ( "context" "fmt" "github.com/dicedb/dicedb-go/wire" "github.com/mark3labs/mcp-go/mcp" "github.com/pottekkat/dicedb-mcp/internal/utils" ) // NewPingTool creates a new ping tool for DiceDB func NewPingTool() mcp.Tool { return mcp.NewTool("ping", mcp.WithDescription("Ping the DiceDB server to check connectivity"), // All tools have a url argument utils.CommonURLParam(), ) } // HandlePingTool handles the ping tool request func HandlePingTool(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { client, err := utils.GetClientFromRequest(request) if err != nil { return nil, err } // Run the PING command on the DiceDB server resp := client.Fire(&wire.Command{Cmd: "PING"}) // Check if DiceDB returned an error if resp.Err != "" { return nil, fmt.Errorf("DiceDB error: %s", resp.Err) } // Return the response to the MCP client return mcp.NewToolResultText(fmt.Sprintf("Response from DiceDB: %s", utils.FormatDiceDBResponse(resp))), nil }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pottekkat/dicedb-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server