Skip to main content
Glama

get_hot_keys

Retrieve top frequently accessed keys from Valkey/Redis to identify cache-busting patterns, uneven access distribution, and throughput-dominant keys using LFU scores or idle-time tracking.

Instructions

Get hot key tracking data from persisted storage. BetterDB periodically scans keys using LFU frequency scores (when maxmemory-policy is an LFU variant) or OBJECT IDLETIME / COMMANDLOG-derived frequency. Each snapshot captures the top keys ranked by access frequency. Use this to find cache-busting keys, uneven access patterns, or keys that dominate throughput. The signalType field in each entry indicates which detection mode was active (lfu or idletime).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startTimeNoStart time (Unix timestamp ms)
endTimeNoEnd time (Unix timestamp ms)
limitNoMax entries to return (default 50, max 200)
instanceIdNoOptional instance ID override

Implementation Reference

  • The 'get_hot_keys' tool is registered and implemented directly in the MCP server setup within packages/mcp/src/index.ts. It executes a network request to the API via 'apiFetch' to fetch the hot key data.
    server.tool(
      'get_hot_keys',
      'Get hot key tracking data from persisted storage. BetterDB periodically scans keys using LFU frequency scores (when maxmemory-policy is an LFU variant) or OBJECT IDLETIME / COMMANDLOG-derived frequency. Each snapshot captures the top keys ranked by access frequency. Use this to find cache-busting keys, uneven access patterns, or keys that dominate throughput. The signalType field in each entry indicates which detection mode was active (lfu or idletime).',
      {
        startTime: z.number().optional().describe('Start time (Unix timestamp ms)'),
        endTime: z.number().optional().describe('End time (Unix timestamp ms)'),
        limit: z.number().optional().describe('Max entries to return (default 50, max 200)'),
        instanceId: z.string().optional().describe('Optional instance ID override'),
      },
      async ({ startTime, endTime, limit, instanceId }) => {
        const id = resolveInstanceId(instanceId);
        const qs = buildQuery({ startTime, endTime, limit });
        const data = await apiFetch(`/mcp/instance/${id}/hot-keys${qs}`);
        if (isLicenseError(data)) {
          return { content: [{ type: 'text' as const, text: licenseErrorResult(data) }] };
        }
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
        };
      },
    );

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