echocache
v0.1.3MCP server caching expensive LLM responses: HTTP-style freshness plus semantic recall.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
cache_get
Look up a cached LLM response by exact (model, prompt, params) match, like an HTTP cache checking a request against its cache key. Call this BEFORE issuing an expensive prompt to a model. Returns hit:false on a miss or an expired entry — in that case, run the prompt yourself and store the result with cache_set. On a hit, freshness mirrors HTTP semantics: fresh means use it as-is; stale means it is past its TTL but within its stale-while-revalidate window, so you may still use it but consider refreshing it.
| Parameter | Type | Description |
|---|---|---|
model * | string | Model/tool identifier the response came from, e.g. "claude-sonnet-5" |
prompt * | string | The exact prompt or request text |
params | object | Other call parameters that affect the response (temperature, system prompt, etc.) |
cache_set
Store a prompt/response pair in the cache. Call this AFTER getting a fresh response from a model that cache_get did not have. New entries are automatically linked in a similarity graph to existing entries with related content, so cache_related and cache_query can surface them later even without an exact key match. Pass derived_from with parent entry ids if this result was built from other cached entries — invalidating a parent with cascade can then clean up anything derived from it.
| Parameter | Type | Description |
|---|---|---|
model * | string | |
prompt * | string | |
response * | string | The response text to cache |
derived_from | array | Ids of parent entries this was built from |
params | object | |
stale_while_revalidate_seconds | integer | Extra window after TTL expiry where the entry is still returned, marked stale |
tags | array | |
ttl_seconds | Freshness lifetime in seconds. null = never expires. Default: 1 day |
cache_query
Semantic search across all cached entries, independent of exact key matching. Use this when you suspect something related was already computed even though the prompt wording differs — the knowledge-graph equivalent of a cache lookup by meaning instead of by exact key.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text to search for semantically related cache entries |
min_similarity | number | Similarity floor 0-1, default 0.3 |
top_k | integer | Max results, default 5 |
cache_invalidate
Delete a cache entry, e.g. because the underlying source it was based on changed. With cascade:true, also deletes every entry that declared this one as a derived_from parent, and recursively theirs — dependency-graph invalidation instead of a manual hunt for stale copies.
| Parameter | Type | Description |
|---|---|---|
id * | string | |
cascade | boolean | Also delete entries derived from this one, default false |
cache_stats
Cache analytics: entry/edge counts, exact-match hit rate, queryHits/queryMisses for semantic recall, and tokensServed — the token count handed back from cache. Note that tokensServed equals tokens *saved* only for entries that stand in for work which would otherwise be regenerated; serving a cached file read costs the same tokens as re-reading the file, so it saves nothing.