Skip to main content
Glama

get_slot_stats

Analyze Valkey database slots to identify hot slots by CPU usage or find most populated slots by key count for performance optimization.

Instructions

Get per-slot key counts and CPU usage (Valkey 8.0+ only). Use orderBy='cpu-usec' to find hot slots, or 'key-count' to find the most populated slots. Returns an error message if not supported.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderByNoSort order: 'key-count' or 'cpu-usec' (default 'key-count')
limitNoMax slots to return (default 20)
instanceIdNoOptional instance ID override

Implementation Reference

  • The handler for the 'get_slot_stats' tool, which fetches data from the '/mcp/instance/${id}/cluster/slot-stats' endpoint.
    async ({ orderBy, limit, instanceId }) => {
      const id = resolveInstanceId(instanceId);
      const qs = buildQuery({ orderBy, limit });
      const data = await apiFetch(`/mcp/instance/${id}/cluster/slot-stats${qs}`);
      return {
        content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
      };
    },
  • Registration of the 'get_slot_stats' tool within the MCP server, defining its schema and description.
    server.tool(
      'get_slot_stats',
      "Get per-slot key counts and CPU usage (Valkey 8.0+ only). Use orderBy='cpu-usec' to find hot slots, or 'key-count' to find the most populated slots. Returns an error message if not supported.",
      {
        orderBy: z.enum(['key-count', 'cpu-usec']).optional().describe("Sort order: 'key-count' or 'cpu-usec' (default 'key-count')"),
        limit: z.number().optional().describe('Max slots to return (default 20)'),
        instanceId: z.string().optional().describe('Optional instance ID override'),
      },

Latest Blog Posts

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/BetterDB-inc/monitor'

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