Skip to main content
Glama

cache_list

List all caches registered for the active instance, displaying hit rate and total operations for each cache.

Instructions

List all caches (semantic_cache and agent_cache) registered for the active instance, with hit rate and total ops.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceIdNoConnection ID; defaults to the active instance

Implementation Reference

  • Tool 'cache_list' is registered using server.tool() with the name 'cache_list', description 'List all caches...', schema (instanceId optional), and handler.
    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,
          };
        }
      }),
    );
  • Handler for cache_list: resolves instanceId, calls GET /mcp/instance/{id}/caches, formats output as name/type/status/hit rate/ops.
      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,
          };
        }
      }),
    );
  • Input schema for cache_list: optional instanceId parameter (string matching /^[a-zA-Z0-9_-]+$/).
    {
      instanceId: z.string().regex(/^[a-zA-Z0-9_-]+$/).optional().describe('Connection ID; defaults to the active instance'),
    },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description implies a read-only operation but doesn't explicitly state read-only behavior, authentication requirements, or other traits. No annotations provided, so the description carries moderate burden but doesn't add significant behavioral context beyond the obvious.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence of 20 words, front-loaded with the main action and resource. No redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with one optional parameter and no output schema, the description provides sufficient context (lists all caches, returns hit rate and total ops). Lacks details on pagination or limits but is adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the parameter's description already includes the defaulting behavior. The tool description doesn't add new semantic meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List', the resource 'caches' (with types), and includes output details (hit rate, total ops). It distinguishes itself from sibling cache tools like cache_health or cache_list_pending_proposals.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. No explicit when-not-to-use or mentions of preconditions or relationships with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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