cache_list
List all registered caches for an active database instance, showing hit rate and total operations to monitor cache efficiency.
Instructions
List all caches (semantic_cache and agent_cache) registered for the active instance, with hit rate and total ops.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instanceId | No | Connection ID; defaults to the active instance |
Implementation Reference
- packages/mcp/src/index.ts:726-755 (handler)The 'cache_list' MCP tool handler. Lists all caches (semantic_cache and agent_cache) registered for the active instance, with hit rate and total ops. Calls GET /mcp/instance/{id}/caches and formats the response into a human-readable list.
server.tool( 'cache_list', 'List all caches (semantic_cache and agent_cache) registered for the active instance, with hit rate and total ops.', { instanceId: z.string().regex(/^[a-zA-Z0-9_-]+$/).optional().describe('Connection ID; defaults to the active instance'), }, async (params) => withTelemetry('cache_list', async () => { try { const id = resolveInstanceId(params.instanceId); const data = await apiFetch(`/mcp/instance/${id}/caches`) as { caches: Array<{ name: string; type: string; hit_rate: number; total_ops: number; status: string }>; }; if (isLicenseError(data)) { return { content: [{ type: 'text' as const, text: licenseErrorResult(data) }] }; } if (data.caches.length === 0) { return { content: [{ type: 'text' as const, text: 'No caches registered for this instance.' }] }; } const lines = data.caches.map((c) => `${c.name} (${c.type}, ${c.status}) — hit rate ${(c.hit_rate * 100).toFixed(1)}%, ops ${c.total_ops}`, ); return { content: [{ type: 'text' as const, text: lines.join('\n') }] }; } catch (err) { return { content: [{ type: 'text' as const, text: err instanceof Error ? err.message : String(err) }], isError: true, }; } }), ); - packages/mcp/src/index.ts:729-731 (schema)The input schema for 'cache_list' — accepts an optional instanceId parameter (alphanumeric, dash, underscore).
{ instanceId: z.string().regex(/^[a-zA-Z0-9_-]+$/).optional().describe('Connection ID; defaults to the active instance'), }, - packages/mcp/src/index.ts:726-755 (registration)The tool is registered with the MCP server via server.tool('cache_list', ...) on line 727.
server.tool( 'cache_list', 'List all caches (semantic_cache and agent_cache) registered for the active instance, with hit rate and total ops.', { instanceId: z.string().regex(/^[a-zA-Z0-9_-]+$/).optional().describe('Connection ID; defaults to the active instance'), }, async (params) => withTelemetry('cache_list', async () => { try { const id = resolveInstanceId(params.instanceId); const data = await apiFetch(`/mcp/instance/${id}/caches`) as { caches: Array<{ name: string; type: string; hit_rate: number; total_ops: number; status: string }>; }; if (isLicenseError(data)) { return { content: [{ type: 'text' as const, text: licenseErrorResult(data) }] }; } if (data.caches.length === 0) { return { content: [{ type: 'text' as const, text: 'No caches registered for this instance.' }] }; } const lines = data.caches.map((c) => `${c.name} (${c.type}, ${c.status}) — hit rate ${(c.hit_rate * 100).toFixed(1)}%, ops ${c.total_ops}`, ); return { content: [{ type: 'text' as const, text: lines.join('\n') }] }; } catch (err) { return { content: [{ type: 'text' as const, text: err instanceof Error ? err.message : String(err) }], isError: true, }; } }), );