Skip to main content
Glama

optimize_cache

Idempotent

Improve cache hit rates by reorganizing memories: promote frequently accessed items to short-term, demote cold data to long-term, and evict old entries.

Instructions

Reorganize cache for optimal hit rates. Promotes frequently accessed memories to L1 (24h TTL), demotes cold data to L2 (7d TTL). Use periodically for large memory stores. May temporarily increase latency during optimization. Returns: summary of cached memories. Side effects: modifies cache TTLs, may evict old entries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_memoriesNoMaximum memories to keep in cache. Range: 100-10000. Older/colder items evicted first. Default: 1000.
force_refreshNotrue: clear cache and reload all from storage. false: optimize existing cache. Default: false.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed4 schema fields changedv1.3.2
    • removedInput schema / properties / force_refresh / default
      Removed value: -false
    • changedInput schema / properties / force_refresh / description
      Previous value: -"Force refresh all memories from cloud"New value: +"true: clear cache and reload all from storage. false: optimize existing cache. Default: false."
    • removedInput schema / properties / max_memories / default
      Removed value: -1000
    • changedInput schema / properties / max_memories / description
      Previous value: -"Maximum memories to cache"New value: +"Maximum memories to keep in cache. Range: 100-10000. Older/colder items evicted first. Default: 1000."
  2. First observedv1.3.1

TDQS

A4.5/5.0
Behavior5/5

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

The description goes well beyond the annotations by disclosing concrete side effects: 'modifies cache TTLs, may evict old entries' and the caveat 'May temporarily increase latency during optimization'. It also states the return value, which is useful given there is no output schema. These details add valuable context beyond readOnlyHint and idempotentHint.

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?

Four sentences, each carrying essential information: purpose, mechanism, usage timing, side effects, and output. The most important purpose is front-loaded, and there is no filler or repetition of schema content.

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

Completeness5/5

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

For a two-parameter tool with fully documented schema and no output schema, the description covers all necessary call context: what it does, when to run it, side effects, latency risk, and what it returns. Nothing an agent needs to invoke it correctly is missing.

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?

The schema covers both parameters with thorough descriptions (ranges, defaults, behavior for force_refresh), so the description does not need to repeat them. The description adds no parameter-specific detail, but per the baseline for 100% schema coverage, a 3 is appropriate.

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 opens with a specific verb and resource: 'Reorganize cache for optimal hit rates', and then details the exact mechanism (promoting to L1 with 24h TTL, demoting to L2 with 7d TTL). This clearly distinguishes it from siblings like cache_stats (read-only reporting) or deduplicate_memories (removing duplicates), so an agent can tell them apart without inspecting schemas.

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

Usage Guidelines4/5

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

The description explicitly says 'Use periodically for large memory stores', giving a clear when-to-use condition. However, it does not mention when not to use it or name alternatives, so it falls just short of the highest bar.

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

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/n3wth/r3'

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