Skip to main content
Glama

llmkit_local_cache

Read-onlyIdempotent

Analyze prompt caching savings across AI coding tools to track cost reductions from cached responses.

Instructions

Cache savings analysis across all detected AI coding tools. Shows how much prompt caching saved.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
savingsNo
totalSavedUsdYes

Implementation Reference

  • The 'handleLocalCache' function calculates and reports prompt caching savings by aggregating data from available AI tool adapters.
    export async function handleLocalCache() {
      const active = await detectAdapters();
      if (active.length === 0) return fail('No AI coding tool data found. Works with Claude Code and Cline.');
    
      const results = await Promise.allSettled(active.map(a => a.getCacheSavings()));
      const savings = results
        .map(r => r.status === 'fulfilled' ? r.value : null)
        .filter(s => s !== null);
    
      if (savings.length === 0) return fail('No cache data found.');
    
      const totalSaved = savings.reduce((s, x) => s + x.totalSaved, 0);
      const lines = [
        'Cache Savings (all tools)',
        '\u2500'.repeat(25),
        `Total saved: $${totalSaved.toFixed(4)}`,
        '',
      ];
    
      for (const s of savings) {
        lines.push(`${s.source}: saved $${s.totalSaved.toFixed(4)}, ${s.readToWriteRatio.toFixed(1)}x read/write ratio`);
        for (const m of s.models) {
          lines.push(`  ${m.model}: saved $${m.saved.toFixed(4)}, ${m.ratio.toFixed(1)}x ratio (${(m.cacheRead / 1000).toFixed(0)}k reads, ${(m.cacheWrite / 1000).toFixed(0)}k writes)`);
        }
      }
    
      return ok(lines.join('\n'), { savings, totalSavedUsd: totalSaved });
    }
  • Definition of the 'llmkit_local_cache' tool including input/output schemas and description.
      name: 'llmkit_local_cache',
      description: 'Cache savings analysis across all detected AI coding tools. Shows how much prompt caching saved.',
      inputSchema: { type: 'object' as const, properties: {} },
      outputSchema: {
        type: 'object' as const,
        properties: {
          savings: { type: 'array', items: { type: 'object', properties: { source: { type: 'string' }, totalSaved: { type: 'number' }, readToWriteRatio: { type: 'number' } } } },
          totalSavedUsd: { type: 'number' },
        },
        required: ['totalSavedUsd'],
      },
      annotations: { title: 'Cache Savings', ...HINTS },
    },
  • Registration of the 'llmkit_local_cache' tool in the HANDLER_MAP.
    llmkit_local_cache: () => handleLocalCache(),
Behavior3/5

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

Annotations already provide key behavioral traits: readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=false. The description adds context about what the tool analyzes (cache savings across AI coding tools) and the specific focus on prompt caching savings, which is useful beyond annotations. However, it doesn't disclose additional behavioral aspects like rate limits, authentication needs, or data freshness.

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?

The description is a single, efficient sentence that directly states the tool's purpose without any fluff. It's front-loaded with the core action and outcome, making it easy to understand quickly. Every word earns its place.

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?

Given the tool has 0 parameters, rich annotations (covering safety and idempotency), and an output schema (which handles return values), the description is reasonably complete. It clearly explains what the tool does (cache savings analysis) and the scope (across AI coding tools, focusing on prompt caching). However, it lacks guidance on usage relative to siblings, which is a minor gap in context.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100% (though empty). With no parameters, the baseline is 4. The description doesn't need to explain parameters, and it appropriately focuses on the tool's purpose without redundant information.

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

Purpose4/5

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

The description clearly states what the tool does: 'Cache savings analysis across all detected AI coding tools. Shows how much prompt caching saved.' It specifies the action (analysis), scope (across all detected AI coding tools), and outcome (shows savings from prompt caching). However, it doesn't explicitly differentiate from sibling tools like 'llmkit_usage_stats' or 'llmkit_cost_query' which might also relate to cost/savings metrics.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, timing (e.g., after cache operations), or how it differs from siblings such as 'llmkit_usage_stats' (which might show usage) or 'llmkit_cost_query' (which might show costs). Usage is implied only by the purpose statement.

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/smigolsmigol/llmkit-mcp-server'

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