apollo-cache-copilot
This MCP server lets AI agents diagnose and repair Apollo Client cache normalization defects from a serialized cache.extract() snapshot.
inspect_dangling_refs — read-only audit of a cache snapshot for orphaned
__refpointers, unreachable entities, and objects missing__typename/id, returning findings with exact cache paths plus aggregate stats.patch_cache — apply declarative repairs (modify fields via DELETE/INVALIDATE/SET/PRUNE_DANGLING_REFS, or evict entities/fields), optionally run
cache.gc(), with adryRunmode that validates without mutating; returns per-operation results and the patched store.diagnose_cache_graph — run the full inspect → reason → plan pipeline over a cache snapshot, producing findings, proposed patch operations, and step-by-step narration; plans only and never mutates.
Because it works over serialized JSON via stdio, it integrates with MCP clients like Claude Desktop and Cursor, letting agents reason about cache corruption without loading the whole cache into context.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@apollo-cache-copilotCheck my Apollo cache for dangling refs and missing typenames"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
apollo-cache-copilot
AI copilot and MCP server for diagnosing Apollo InMemoryCache normalization
defects — built for React Native, where Apollo DevTools does not exist.
The Problem
Apollo Client normalizes every result into a flat map of __typename:id
entities and stores cross-references as { "__ref": "Type:id" } pointers. That
normalization is invisible at write time and only fails at read time — usually
on a screen far away from the mutation that caused it. Three failure classes
dominate, and all three are silent:
Defect | What Apollo does | Symptom |
Orphaned pointer — | Returns | Blank row, no throw |
Missing | Cannot compute a cache key, stores the object inline | Renders fine, then diverges on the second write |
Type/key drift — | Same logical entity under two keys | Duplicated list items, stale reads |
React Native makes every one of them worse:
No Apollo DevTools. The browser extension is the primary cache debugger and it does not exist on RN. The fallback is
console.log(JSON.stringify(client.cache.extract()))and reading a multi-megabyte blob by eye.Persisted cache.
apollo3-cache-persist+ AsyncStorage means a corrupt cache survives app restart — sticky, and reproducing on the user's device only.Offline-first mutations. Optimistic responses write partial entities by design, which is exactly the shape that trips defects 1 and 2.
Long sessions. Mobile apps stay resident for days, so drift accumulates far longer than in a browser tab.
Related MCP server: mcp-rn-devtools
The Solution
Detection is deterministic. Explanation is the model's job.
A cache analyzer that walks
cache.extract()output and reports structural defects with exact paths (User:1.avatar → Avatar:99). Plain graph traversal — no model involved, no guessing, runs on a 10MB snapshot.An MCP server exposing that analyzer to whichever agent the developer is already talking to. The agent asks for findings plus the relevant subgraph, so it never has to hold the whole cache in context.
Diagnosis moves from "paste a 10MB blob and squint" to a conversation.
Architecture
Four-figure walkthrough — the defect, the process, the graph, the JSON boundary: docs/ARCHITECTURE.md
ASCII, same thing:
MCP client (Claude Desktop, Cursor, any stdio client)
│ JSON-RPC 2.0 ▲
▼ over stdio │ stdout IS the protocol channel —
┌─────────────────────────────────┐ all logs go to stderr
│ StdioServerTransport │
├─────────────────────────────────┤
│ tools: inspect_dangling_refs │ read-only
│ patch_cache │ mutating (dryRun available)
│ diagnose_cache_graph │ read-only, plans only
├─────────────────────────────────┤
│ Zod schemas — parse at the edge │
└───────────────┬─────────────────┘
▼
┌─────────────────────────────────────────────────────┐
│ cacheAgentGraph (LangGraph, deliberately LLM-free)│
│ │
│ INSPECTOR ──────► REASONER ──────► PATCHER │
│ walks the store maps findings narrates the │
│ → findings[] → patch ops plan │
│ │ │ │
│ │ owns `findings` │ owns `proposedPatches` │
│ ├── no findings ──► END (skips both) │
│ │ │ │
└──────┼──────────────────┼───────────────────────────┘
▼ ▼
inspectDanglingRefs() patchCache()
pure, on a snapshot cache.modify / evict / gc on a live cacheEach graph node owns exactly one state channel — the inspector writes
findings, the reasoner writes proposedPatches, the patcher writes messages.
Only messages accumulates; re-running a node re-analyzes the same cache, so
appending elsewhere would duplicate every finding on the second pass.
Why no LLM in the graph? Every defect this copilot detects has a mechanical
repair (prune the pointer, evict the orphan). A model would add latency, cost
and nondeterminism to a decision a switch already makes correctly. The graph
earns its keep as orchestration; the model lives in the MCP client, where it
correlates a finding with the mutation or fragment that wrote it.
Installation
npm install apollo-cache-copilot
# or, from a checkout
npm install && npm run buildRequires Node.js ≥ 20 (vitest 4 and @langchain/core both require it; CI covers 20 and 22). @apollo/client (v3.8+ or v4), react, and
react-native are peer dependencies — the package uses your app's copies.
Library Usage
ESM only. The package ships types.
inspectDanglingRefs — audit a snapshot
Pure and synchronous. Takes cache.extract() output, returns findings + stats.
import { inspectDanglingRefs } from 'apollo-cache-copilot';
const { findings, stats } = inspectDanglingRefs({
cache: client.cache.extract(),
// all optional:
rootIds: ['ROOT_QUERY', 'ROOT_MUTATION'], // reachability roots
includeUnreachable: true, // report gc candidates
includeNormalizationGaps: true, // report un-keyable inline objects
});
console.log(stats);
// { entityCount: 4, refCount: 3, danglingCount: 1, unreachableCount: 1 }
for (const f of findings) {
console.log(f.kind, f.path, f.danglingRef ?? '');
// ORPHANED_REF User:1.avatar Avatar:99
// UNREACHABLE_ENTITY Post:7
}Finding kinds: ORPHANED_REF, UNREACHABLE_ENTITY, MISSING_TYPENAME,
MISSING_ID. Every finding carries an exact cache path.
patchCache — apply repairs to a live cache
Operations are declarative descriptors so they survive a JSON hop; the tool
rehydrates them into the functions cache.modify wants. Ordered, and failures
are recorded rather than thrown so a bad key mid-batch cannot strand the cache
half-patched.
import { patchCache } from 'apollo-cache-copilot';
const { dryRun, results, collected } = patchCache(client.cache, {
operations: [
// drop dangling refs from a list field
{ type: 'modify', id: 'User:1', fields: { posts: { action: 'PRUNE_DANGLING_REFS' } } },
// delete / invalidate / overwrite a field
{ type: 'modify', id: 'User:1', fields: { avatar: { action: 'DELETE' } } },
{ type: 'modify', id: 'User:1', fields: { bio: { action: 'SET', value: 'unset' } } },
// evict an entity, or one field of it
{ type: 'evict', id: 'Post:7' },
{ type: 'evict', id: 'ROOT_QUERY', fieldName: 'user', args: { id: '1' } },
],
gc: true, // run cache.gc() once, after everything lands
dryRun: false, // true = validate only, cache untouched
});
results.forEach((r) => console.log(r.changed, r.error ?? ''));
console.log('collected:', collected); // keys gc() removedField actions: DELETE, INVALIDATE, SET (with value),
PRUNE_DANGLING_REFS.
cacheAgentGraph — inspect → reason → plan
The compiled LangGraph. Returns findings, the patch operations it would apply,
and per-step narration. It never mutates — feed proposedPatches to
patchCache when you have reviewed them.
import { cacheAgentGraph } from 'apollo-cache-copilot';
const state = await cacheAgentGraph.invoke({ cacheState: client.cache.extract() });
state.messages.forEach((m) => console.log(String(m.content)));
// 2 findings: 1 orphaned ref, 1 unreachable entity.
// ...
// Review, then apply:
patchCache(client.cache, { operations: state.proposedPatches });Also exported: buildCacheAgentGraph() (uncompiled builder), the individual
nodes inspectorNode / reasonerNode / patcherNode, CacheAgentAnnotation,
every Zod schema (InspectDanglingRefsInputSchema, PatchCacheInputSchema, …)
and its inferred type, plus the MCP surface (createServer,
startStdioServer, runInspectDanglingRefs, runPatchCache,
runDiagnoseCacheGraph).
CLI Usage
apollo-copilot [mcp] Start the stdio MCP server (default when no args)
apollo-copilot inspect FILE Diagnose a JSON cache snapshot and print findingsapollo-copilot inspect <file>
Dump the cache from your app, then read it:
// in the RN app
console.log(JSON.stringify(client.cache.extract()));npx -y -p apollo-cache-copilot apollo-copilot inspect ./cache-snapshot.json━━ Cache Diagnostic ━━
Entities: 4 | Refs: 3 | Dangling: 1 | Unreachable: 1
⚠ ORPHANED_REF (1)
• User:1.avatar → Avatar:99
Points at "Avatar:99", which is not in the cache. Reads here return undefined.
🗑 UNREACHABLE_ENTITY (1)
• Post:7
No root reaches this entity; cache.gc() would collect it.A clean cache prints ✓ Cache is clean: no findings.
Exit codes: 0 success, 1 unexpected failure, 2 bad input (missing file,
unreadable file, invalid JSON, unknown command).
apollo-copilot mcp
Starts the MCP server on stdio and blocks. Only useful when an MCP client owns
the process — see below. apollo-copilot-mcp is a legacy alias for the same
thing.
stdout is the protocol channel. The server writes nothing but JSON-RPC to stdout; all diagnostics go to stderr. Never add a
console.logto this path.
MCP Setup
Tools exposed
Tool | Input | Behavior |
|
| Read-only. Returns |
|
| Read-only. Runs the full graph. Returns |
|
| Restores the snapshot into a throwaway |
patch_cache carries the snapshot because a stdio server has no live cache to
hand the patcher — only JSON. Diff the returned cache against yours, or
client.cache.restore() it.
Every tool returns both a human-readable summary line and machine-readable
structuredContent, so clients that don't understand structured output still
get the JSON.
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or
%APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"apollo-cache-copilot": {
"command": "npx",
"args": ["-y", "-p", "apollo-cache-copilot", "apollo-copilot", "mcp"]
}
}
}From a local checkout — build first (npm run build), then point at the bin
with an absolute path:
{
"mcpServers": {
"apollo-cache-copilot": {
"command": "node",
"args": ["/absolute/path/to/apollo-cache-copilot/bin/apollo-copilot.js", "mcp"]
}
}
}Restart Claude Desktop. The three tools appear under the tools menu.
Cursor
.cursor/mcp.json in the project (or ~/.cursor/mcp.json for every project):
{
"mcpServers": {
"apollo-cache-copilot": {
"command": "npx",
"args": ["-y", "-p", "apollo-cache-copilot", "apollo-copilot", "mcp"]
}
}
}Local checkout:
{
"mcpServers": {
"apollo-cache-copilot": {
"command": "node",
"args": ["${workspaceFolder}/bin/apollo-copilot.js", "mcp"]
}
}
}Then Cursor → Settings → MCP → confirm the server is green.
Then just ask
"Here's my cache snapshot — why is the avatar blank on the profile screen?"
The agent calls diagnose_cache_graph, gets User:1.avatar → Avatar:99 plus the
proposed PRUNE_DANGLING_REFS, and correlates it with the mutation that wrote a
reference without the entity body.
Development
npm install
npm run build # tsc -> dist/ (run first: typecheck and tests import dist)
npm run typecheck # tsc --noEmit -p tsconfig.test.json (includes tests)
npm test # vitest runtsconfig.json is the build and excludes __tests__ / __mocks__ so the
published package is just the tools. tsconfig.test.json type-checks
everything and emits nothing.
Success Metrics
# | Metric | Target |
1 | Detection recall on the fixture suite | 100% — every seeded defect found |
2 | False positives on a healthy snapshot | 0 |
3 | Analyzer runtime on a 10MB | < 1s |
4 | Findings carrying an exact cache path | 100% |
5 | Developer time from symptom to named root cause | < 5 min (vs. hours) |
6 | Tokens sent to the model per diagnosis | < 10k — findings + subgraph, never the whole cache |
Contributing
Contributions welcome. Start with CONTRIBUTING.md — it
covers setup, the seven invariants in this codebase that break silently
(stdout is the protocol channel; Apollo 3.x needs explicit /index.js imports;
only messages accumulates in the graph state), and the seven-step checklist
for adding a new defect kind.
Two open starters, both small and both live in the tree today:
compareQueryToCacheis declared but unimplemented — schemas and types exist insrc/schemas/tools.tsand are exported, but no tool backs them.The CLI prints a
DANGLING_REFbranch that never fires —bin/apollo-copilot.js:71lists a kindFindingKindSchemanever emits.
Bug reports need a minimal cache.extract() snapshot; the
issue form asks for one, because with a
snapshot almost every report is reproducible in a single command.
By participating you agree to the Code of Conduct.
Found a security issue? Do not open a public issue — see
SECURITY.md. Note that a cache.extract() snapshot is
production data: scrub it before pasting it anywhere, including into a chat
with a model.
License
ISC — see LICENSE.
Available Tools
3 toolsdiagnose_cache_graphDiagnose cache graphARead-only
Run the full inspect -> reason -> plan graph over a serialized cache. Returns findings, the proposed patch operations (feed them to patch_cache), and per-step narration. Plans only; never mutates.
| Name | Required | Description | Default |
|---|---|---|---|
| cache | Yes | The full serialized cache, exactly as returned by `cache.extract()`. Keys are cache IDs (e.g. "ROOT_QUERY", "User:1"); values are that entity's stored fields, which may contain `{ "__ref": "<cache id>" }` pointers to other entries in this same object. |
Output Schema
| Name | Required | Description |
|---|---|---|
| findings | Yes | Every defect the inspector found in `cache`. |
| narration | Yes | |
| proposedPatches | Yes | Mechanically-derived fixes for the fixable findings, ready to pass to patch_cache as-is. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The annotations already declare readOnlyHint=true, and the description reinforces this with 'Plans only; never mutates.' It adds useful behavioral context about what the tool does not do and how its output should be consumed, going beyond the structured annotation without contradicting it.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two dense sentences deliver the pipeline, the return value, the downstream consumer, and the side-effect guarantee. Every phrase earns its place and the most important behavioral constraint is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter tool with a fully documented schema and an output schema, the description is complete: it names the inputs, outputs, downstream action, and non-mutating behavior. 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.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already provides 100% coverage, including a detailed description of the cache object and its structure. The tool description does not need to restate parameter details; the schema carries the semantic weight, so the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb and resource ('Run the full inspect -> reason -> plan graph over a serialized cache') and clearly differentiates itself from the sibling tools by describing its broader pipeline. It also states what it returns, making its role unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when this tool fits: it produces patch operations that should be fed to patch_cache, and it is a planning-only step. It does not explicitly state when to prefer it over inspect_dangling_refs, but the pipeline framing and output-to-patch_cache relationship make the usage context clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
inspect_dangling_refsInspect dangling refsARead-only
Audit a serialized Apollo InMemoryCache (cache.extract() output) for dangling __refs, unreachable entities, and objects Apollo could not normalize. Read-only.
| Name | Required | Description | Default |
|---|---|---|---|
| cache | Yes | The full serialized cache, exactly as returned by `cache.extract()`. Keys are cache IDs (e.g. "ROOT_QUERY", "User:1"); values are that entity's stored fields, which may contain `{ "__ref": "<cache id>" }` pointers to other entries in this same object. | |
| rootIds | No | Cache IDs to treat as reachability roots for the UNREACHABLE_ENTITY check, e.g. ["ROOT_QUERY"]. Omit to use every one of ROOT_QUERY / ROOT_MUTATION / ROOT_SUBSCRIPTION that is present in `cache`. Has no effect on ORPHANED_REF or normalization-gap findings. | |
| includeUnreachable | No | Include UNREACHABLE_ENTITY findings for entities no root can reach (candidates `cache.gc()` would collect). Set false to skip reachability analysis and only check refs/normalization. | |
| includeNormalizationGaps | No | Include MISSING_TYPENAME / MISSING_ID findings for inline (non-entity) objects that Apollo could not normalize because they lack a `__typename` or an `id`/`_id` field. |
Output Schema
| Name | Required | Description |
|---|---|---|
| stats | Yes | Aggregate counts over the whole cache, independent of the findings list. |
| findings | Yes | Every defect found, in walk order. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already provide readOnlyHint, and the description repeats 'Read-only.' It adds the scope of audit findings but no additional behavioral context such as error behavior, performance implications, or what the tool does not inspect. With the safety profile already covered by annotations, this is adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences totaling 19 words. It front-loads the verb, resource, and primary finding types, and 'Read-only' is a harmless, minimal redundancy with the annotation. Every word contributes to understanding what the tool does.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has 4 parameters, 2 siblings, and subtle optional-parameter interactions, but the input schema is exceptionally detailed and an output schema exists, so the short description is sufficient for invocation. The main completeness gap is the lack of an explicit decision rule versus diagnose_cache_graph, preventing a 5.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with detailed parameter documentation for cache, rootIds, includeUnreachable, and includeNormalizationGaps, including defaults and effects on findings. The description itself adds no parameter-level detail beyond the cache.extract() context, so the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with the specific verb 'Audit' and names the exact resource: a serialized Apollo InMemoryCache from cache.extract(). It then enumerates the three distinct finding categories (dangling __refs, unreachable entities, normalization gaps), which makes the tool's scope precise and differentiates it from the write-oriented patch_cache and the broader-sounding diagnose_cache_graph.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied: use this when you have cache.extract() output and need to audit for ref/reachability/normalization issues. However, there is no explicit when-to-use versus alternatives, no exclusions, and no routing to sibling tools such as diagnose_cache_graph. The context is clear but the guidance is not explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
patch_cachePatch cacheAIdempotent
Apply declarative repairs (modify / evict, optional gc) to a serialized cache and return the patched store. Set dryRun to validate the operations without changing anything.
| Name | Required | Description | Default |
|---|---|---|---|
| gc | No | Run `cache.gc()` once after all operations land, to collect anything the patches orphaned. | |
| cache | Yes | The full serialized cache, exactly as returned by `cache.extract()`. Keys are cache IDs (e.g. "ROOT_QUERY", "User:1"); values are that entity's stored fields, which may contain `{ "__ref": "<cache id>" }` pointers to other entries in this same object. | |
| dryRun | No | Validate `operations` and report what would happen without mutating the cache. | |
| operations | Yes | One or more modify/evict operations to apply, in order. |
Output Schema
| Name | Required | Description |
|---|---|---|
| cache | Yes | The store after the operations landed. Unchanged when `dryRun` is true. |
| dryRun | Yes | Echoes the request's dryRun — true means the cache was not actually touched. |
| results | Yes | One result per input operation, in the same order. |
| collected | Yes | Cache keys removed by the trailing `gc()`, when it ran. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations indicate readOnlyHint=false and idempotentHint=true, and the description adds meaningful behavioral context beyond those flags: it explicitly states that dryRun validates without mutating the cache, that the modified store is returned, and that gc is optional. This goes beyond what the annotations alone convey, while not contradicting them.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences with no filler. The core action is front-loaded, and the dryRun safety note earns its place as a critical usage caveat. It is appropriately sized for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the very rich input and output schemas, the description only needs to establish the operation intent, the mutating nature, and the dryRun flow, which it does. The main missing element is explicit guidance on when to choose this tool over the siblings, but the schema and annotations cover most invocation details.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already thoroughly documents each parameter and nested operation shape. The description mentions modify/evict and dryRun, but it does not add parameter-level meaning beyond what the schema provides. The baseline of 3 applies because the schema carries the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool applies declarative repairs (modify/evict, optional gc) to a serialized cache and returns the patched store. The specific verb 'apply' plus the resource 'serialized cache' and operation types distinguish it from the sibling tools inspect_dangling_refs and diagnose_cache_graph, which are non-mutating inspection tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies this tool is for mutating a serialized cache and mentions dryRun for validation, but it gives no explicit guidance on when to use patch_cache versus the sibling tools. No exclusion criteria or alternative routing is provided, so an agent must infer the appropriate context from the tool name and sibling names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v1.0.2- Changed
diagnose_cache_graph8 fields changed- added
Input schema / properties / cache / additionalProperties / descriptionAdded value: +"One normalized store entry: the raw field/value map Apollo keeps under a single cache key." - added
Input schema / properties / cache / descriptionAdded value: +"The full serialized cache, exactly as returned by `cache.extract()`. Keys are cache IDs (e.g. \"ROOT_QUERY\", \"User:1\"); values are that entity's stored fields, which may contain `{ \"__ref\": \"<cache id>\" }` pointers to other entries in this same object." - added
Output schema / properties / findings / descriptionAdded value: +"Every defect the inspector found in `cache`." - added
Output schema / properties / findings / items / properties / danglingRef / descriptionAdded value: +"The unresolved cache key the ref pointed at. Only present when kind is ORPHANED_REF." - added
Output schema / properties / findings / items / properties / message / descriptionAdded value: +"Human-readable explanation of this finding." - added
Output schema / properties / findings / items / properties / path / descriptionAdded value: +"Dotted path to the defect from its cache key, e.g. \"User:2.posts.1\"." - added
Output schema / properties / proposedPatches / descriptionAdded value: +"Mechanically-derived fixes for the fixable findings, ready to pass to patch_cache as-is." - changed
Output schema / properties / proposedPatches / items / oneOfPrevious value: -[ - { - "additionalProperties": false, - "properties": { - "broadcast": { - "default": true, - "type": "boolean" - }, - "fields": { - "additionalProperties": { - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "action": { - "const": "DELETE", - "type": "string" - } - }, - "required": [ - "action" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "action": { - "const": "INVALIDATE", - "type": "string" - } - }, - "required": [ - "action" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "action": { - "const": "SET", - "type": "string" - }, - "value": {} - }, - "required": [ - "action", - "value" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "action": { - "const": "PRUNE_DANGLING_REFS", - "type": "string" - } - }, - "required": [ - "action" - ], - "type": "object" - } - ] - }, - "propertyNames": { - "type": "string" - }, - "type": "object" - }, - "id": { - "default": "ROOT_QUERY", - "type": "string" - }, - "optimistic": { - "default": false, - "type": "boolean" - }, - "type": { - "const": "modify", - "type": "string" - } - }, - "required": [ - "type", - "id", - "fields", - "optimistic", - "broadcast" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "args": { - "additionalProperties": {}, - "propertyNames": { - "type": "string" - }, - "type": "object" - }, - "broadcast": { - "default": true, - "type": "boolean" - }, - "fieldName": { - "type": "string" - }, - "id": { - "type": "string" - }, - "type": { - "const": "evict", - "type": "string" - } - }, - "required": [ - "type", - "id", - "broadcast" - ], - "type": "object" - } -]New value: +[ + { + "additionalProperties": false, + "properties": { + "broadcast": { + "default": true, + "description": "Notify active queries/subscriptions of this change. Set false to patch silently.", + "type": "boolean" + }, + "fields": { + "additionalProperties": { + "oneOf": [ + { + "additionalProperties": false, + "description": "Remove this field from the entity entirely.", + "properties": { + "action": { + "const": "DELETE", + "type": "string" + } + }, + "required": [ + "action" + ], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Mark this field stale so Apollo refetches it, without removing or changing its value.", + "properties": { + "action": { + "const": "INVALIDATE", + "type": "string" + } + }, + "required": [ + "action" + ], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Overwrite this field with `value` (any JSON — a scalar, object, or `{ \"__ref\": \"<cache id>\" }`).", + "properties": { + "action": { + "const": "SET", + "type": "string" + }, + "value": {} + }, + "required": [ + "action", + "value" + ], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Drop any `__ref` pointer(s) this field holds that no longer resolve to an entity in the cache. Works on a single ref or a list of refs; refs that still resolve are left untouched.", + "properties": { + "action": { + "const": "PRUNE_DANGLING_REFS", + "type": "string" + } + }, + "required": [ + "action" + ], + "type": "object" + } + ] + }, + "description": "Map of field name -> FieldPatch describing how to change that one field.", + "propertyNames": { + "type": "string" + }, + "type": "object" + }, + "id": { + "default": "ROOT_QUERY", + "description": "Cache key of the entity to modify, e.g. \"User:2\". Defaults to \"ROOT_QUERY\" if omitted.", + "type": "string" + }, + "optimistic": { + "default": false, + "description": "Apply against the optimistic layer instead of the base cache. Mirrors `cache.modify`'s option.", + "type": "boolean" + }, + "type": { + "const": "modify", + "type": "string" + } + }, + "required": [ + "type", + "id", + "fields", + "optimistic", + "broadcast" + ], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "args": { + "additionalProperties": {}, + "description": "Field arguments to match when evicting a specific parameterized field (used with `fieldName`).", + "propertyNames": { + "type": "string" + }, + "type": "object" + }, + "broadcast": { + "default": true, + "description": "Notify active queries/subscriptions of this eviction. Set false to patch silently.", + "type": "boolean" + }, + "fieldName": { + "description": "Evict only this one field instead of the whole entity at `id`.", + "type": "string" + }, + "id": { + "description": "Cache key of the entity to evict, e.g. \"Post:5\".", + "type": "string" + }, + "type": { + "const": "evict", + "type": "string" + } + }, + "required": [ + "type", + "id", + "broadcast" + ], + "type": "object" + } +]
- Changed
inspect_dangling_refs14 fields changed- added
Input schema / properties / cache / additionalProperties / descriptionAdded value: +"One normalized store entry: the raw field/value map Apollo keeps under a single cache key." - added
Input schema / properties / cache / descriptionAdded value: +"The full serialized cache, exactly as returned by `cache.extract()`. Keys are cache IDs (e.g. \"ROOT_QUERY\", \"User:1\"); values are that entity's stored fields, which may contain `{ \"__ref\": \"<cache id>\" }` pointers to other entries in this same object." - added
Input schema / properties / includeNormalizationGaps / descriptionAdded value: +"Include MISSING_TYPENAME / MISSING_ID findings for inline (non-entity) objects that Apollo could not normalize because they lack a `__typename` or an `id`/`_id` field." - added
Input schema / properties / includeUnreachable / descriptionAdded value: +"Include UNREACHABLE_ENTITY findings for entities no root can reach (candidates `cache.gc()` would collect). Set false to skip reachability analysis and only check refs/normalization." - added
Input schema / properties / rootIds / descriptionAdded value: +"Cache IDs to treat as reachability roots for the UNREACHABLE_ENTITY check, e.g. [\"ROOT_QUERY\"]. Omit to use every one of ROOT_QUERY / ROOT_MUTATION / ROOT_SUBSCRIPTION that is present in `cache`. Has no effect on ORPHANED_REF or normalization-gap findings." - added
Output schema / properties / findings / descriptionAdded value: +"Every defect found, in walk order." - added
Output schema / properties / findings / items / properties / danglingRef / descriptionAdded value: +"The unresolved cache key the ref pointed at. Only present when kind is ORPHANED_REF." - added
Output schema / properties / findings / items / properties / message / descriptionAdded value: +"Human-readable explanation of this finding." - added
Output schema / properties / findings / items / properties / path / descriptionAdded value: +"Dotted path to the defect from its cache key, e.g. \"User:2.posts.1\"." - added
Output schema / properties / stats / descriptionAdded value: +"Aggregate counts over the whole cache, independent of the findings list." - added
Output schema / properties / stats / properties / danglingCount / descriptionAdded value: +"Of those refs, how many did not resolve." - added
Output schema / properties / stats / properties / entityCount / descriptionAdded value: +"Total cache keys in the input." - added
Output schema / properties / stats / properties / refCount / descriptionAdded value: +"Total `__ref` pointers encountered." - added
Output schema / properties / stats / properties / unreachableCount / descriptionAdded value: +"Entities no root reaches."
- Changed
patch_cache15 fields changed- added
Input schema / properties / cache / additionalProperties / descriptionAdded value: +"One normalized store entry: the raw field/value map Apollo keeps under a single cache key." - added
Input schema / properties / cache / descriptionAdded value: +"The full serialized cache, exactly as returned by `cache.extract()`. Keys are cache IDs (e.g. \"ROOT_QUERY\", \"User:1\"); values are that entity's stored fields, which may contain `{ \"__ref\": \"<cache id>\" }` pointers to other entries in this same object." - added
Input schema / properties / dryRun / descriptionAdded value: +"Validate `operations` and report what would happen without mutating the cache." - added
Input schema / properties / gc / descriptionAdded value: +"Run `cache.gc()` once after all operations land, to collect anything the patches orphaned." - added
Input schema / properties / operations / descriptionAdded value: +"One or more modify/evict operations to apply, in order." - changed
Input schema / properties / operations / items / oneOfPrevious value: -[ - { - "properties": { - "broadcast": { - "default": true, - "type": "boolean" - }, - "fields": { - "additionalProperties": { - "oneOf": [ - { - "properties": { - "action": { - "const": "DELETE", - "type": "string" - } - }, - "required": [ - "action" - ], - "type": "object" - }, - { - "properties": { - "action": { - "const": "INVALIDATE", - "type": "string" - } - }, - "required": [ - "action" - ], - "type": "object" - }, - { - "properties": { - "action": { - "const": "SET", - "type": "string" - }, - "value": {} - }, - "required": [ - "action", - "value" - ], - "type": "object" - }, - { - "properties": { - "action": { - "const": "PRUNE_DANGLING_REFS", - "type": "string" - } - }, - "required": [ - "action" - ], - "type": "object" - } - ] - }, - "propertyNames": { - "type": "string" - }, - "type": "object" - }, - "id": { - "default": "ROOT_QUERY", - "type": "string" - }, - "optimistic": { - "default": false, - "type": "boolean" - }, - "type": { - "const": "modify", - "type": "string" - } - }, - "required": [ - "type", - "fields" - ], - "type": "object" - }, - { - "properties": { - "args": { - "additionalProperties": {}, - "propertyNames": { - "type": "string" - }, - "type": "object" - }, - "broadcast": { - "default": true, - "type": "boolean" - }, - "fieldName": { - "type": "string" - }, - "id": { - "type": "string" - }, - "type": { - "const": "evict", - "type": "string" - } - }, - "required": [ - "type", - "id" - ], - "type": "object" - } -]New value: +[ + { + "properties": { + "broadcast": { + "default": true, + "description": "Notify active queries/subscriptions of this change. Set false to patch silently.", + "type": "boolean" + }, + "fields": { + "additionalProperties": { + "oneOf": [ + { + "description": "Remove this field from the entity entirely.", + "properties": { + "action": { + "const": "DELETE", + "type": "string" + } + }, + "required": [ + "action" + ], + "type": "object" + }, + { + "description": "Mark this field stale so Apollo refetches it, without removing or changing its value.", + "properties": { + "action": { + "const": "INVALIDATE", + "type": "string" + } + }, + "required": [ + "action" + ], + "type": "object" + }, + { + "description": "Overwrite this field with `value` (any JSON — a scalar, object, or `{ \"__ref\": \"<cache id>\" }`).", + "properties": { + "action": { + "const": "SET", + "type": "string" + }, + "value": {} + }, + "required": [ + "action", + "value" + ], + "type": "object" + }, + { + "description": "Drop any `__ref` pointer(s) this field holds that no longer resolve to an entity in the cache. Works on a single ref or a list of refs; refs that still resolve are left untouched.", + "properties": { + "action": { + "const": "PRUNE_DANGLING_REFS", + "type": "string" + } + }, + "required": [ + "action" + ], + "type": "object" + } + ] + }, + "description": "Map of field name -> FieldPatch describing how to change that one field.", + "propertyNames": { + "type": "string" + }, + "type": "object" + }, + "id": { + "default": "ROOT_QUERY", + "description": "Cache key of the entity to modify, e.g. \"User:2\". Defaults to \"ROOT_QUERY\" if omitted.", + "type": "string" + }, + "optimistic": { + "default": false, + "description": "Apply against the optimistic layer instead of the base cache. Mirrors `cache.modify`'s option.", + "type": "boolean" + }, + "type": { + "const": "modify", + "type": "string" + } + }, + "required": [ + "type", + "fields" + ], + "type": "object" + }, + { + "properties": { + "args": { + "additionalProperties": {}, + "description": "Field arguments to match when evicting a specific parameterized field (used with `fieldName`).", + "propertyNames": { + "type": "string" + }, + "type": "object" + }, + "broadcast": { + "default": true, + "description": "Notify active queries/subscriptions of this eviction. Set false to patch silently.", + "type": "boolean" + }, + "fieldName": { + "description": "Evict only this one field instead of the whole entity at `id`.", + "type": "string" + }, + "id": { + "description": "Cache key of the entity to evict, e.g. \"Post:5\".", + "type": "string" + }, + "type": { + "const": "evict", + "type": "string" + } + }, + "required": [ + "type", + "id" + ], + "type": "object" + } +] - added
Output schema / properties / cache / additionalProperties / descriptionAdded value: +"One normalized store entry: the raw field/value map Apollo keeps under a single cache key." - added
Output schema / properties / cache / descriptionAdded value: +"The store after the operations landed. Unchanged when `dryRun` is true." - added
Output schema / properties / collected / descriptionAdded value: +"Cache keys removed by the trailing `gc()`, when it ran." - added
Output schema / properties / dryRun / descriptionAdded value: +"Echoes the request's dryRun — true means the cache was not actually touched." - added
Output schema / properties / results / descriptionAdded value: +"One result per input operation, in the same order." - added
Output schema / properties / results / items / properties / changed / descriptionAdded value: +"Whether `cache.modify` / `cache.evict` actually changed anything." - added
Output schema / properties / results / items / properties / error / descriptionAdded value: +"Set when this one operation failed; the rest of the batch still ran." - added
Output schema / properties / results / items / properties / operation / descriptionAdded value: +"The operation this result is reporting on, echoed back." - changed
Output schema / properties / results / items / properties / operation / oneOfPrevious value: -[ - { - "additionalProperties": false, - "properties": { - "broadcast": { - "default": true, - "type": "boolean" - }, - "fields": { - "additionalProperties": { - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "action": { - "const": "DELETE", - "type": "string" - } - }, - "required": [ - "action" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "action": { - "const": "INVALIDATE", - "type": "string" - } - }, - "required": [ - "action" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "action": { - "const": "SET", - "type": "string" - }, - "value": {} - }, - "required": [ - "action", - "value" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "action": { - "const": "PRUNE_DANGLING_REFS", - "type": "string" - } - }, - "required": [ - "action" - ], - "type": "object" - } - ] - }, - "propertyNames": { - "type": "string" - }, - "type": "object" - }, - "id": { - "default": "ROOT_QUERY", - "type": "string" - }, - "optimistic": { - "default": false, - "type": "boolean" - }, - "type": { - "const": "modify", - "type": "string" - } - }, - "required": [ - "type", - "id", - "fields", - "optimistic", - "broadcast" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "args": { - "additionalProperties": {}, - "propertyNames": { - "type": "string" - }, - "type": "object" - }, - "broadcast": { - "default": true, - "type": "boolean" - }, - "fieldName": { - "type": "string" - }, - "id": { - "type": "string" - }, - "type": { - "const": "evict", - "type": "string" - } - }, - "required": [ - "type", - "id", - "broadcast" - ], - "type": "object" - } -]New value: +[ + { + "additionalProperties": false, + "properties": { + "broadcast": { + "default": true, + "description": "Notify active queries/subscriptions of this change. Set false to patch silently.", + "type": "boolean" + }, + "fields": { + "additionalProperties": { + "oneOf": [ + { + "additionalProperties": false, + "description": "Remove this field from the entity entirely.", + "properties": { + "action": { + "const": "DELETE", + "type": "string" + } + }, + "required": [ + "action" + ], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Mark this field stale so Apollo refetches it, without removing or changing its value.", + "properties": { + "action": { + "const": "INVALIDATE", + "type": "string" + } + }, + "required": [ + "action" + ], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Overwrite this field with `value` (any JSON — a scalar, object, or `{ \"__ref\": \"<cache id>\" }`).", + "properties": { + "action": { + "const": "SET", + "type": "string" + }, + "value": {} + }, + "required": [ + "action", + "value" + ], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Drop any `__ref` pointer(s) this field holds that no longer resolve to an entity in the cache. Works on a single ref or a list of refs; refs that still resolve are left untouched.", + "properties": { + "action": { + "const": "PRUNE_DANGLING_REFS", + "type": "string" + } + }, + "required": [ + "action" + ], + "type": "object" + } + ] + }, + "description": "Map of field name -> FieldPatch describing how to change that one field.", + "propertyNames": { + "type": "string" + }, + "type": "object" + }, + "id": { + "default": "ROOT_QUERY", + "description": "Cache key of the entity to modify, e.g. \"User:2\". Defaults to \"ROOT_QUERY\" if omitted.", + "type": "string" + }, + "optimistic": { + "default": false, + "description": "Apply against the optimistic layer instead of the base cache. Mirrors `cache.modify`'s option.", + "type": "boolean" + }, + "type": { + "const": "modify", + "type": "string" + } + }, + "required": [ + "type", + "id", + "fields", + "optimistic", + "broadcast" + ], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "args": { + "additionalProperties": {}, + "description": "Field arguments to match when evicting a specific parameterized field (used with `fieldName`).", + "propertyNames": { + "type": "string" + }, + "type": "object" + }, + "broadcast": { + "default": true, + "description": "Notify active queries/subscriptions of this eviction. Set false to patch silently.", + "type": "boolean" + }, + "fieldName": { + "description": "Evict only this one field instead of the whole entity at `id`.", + "type": "string" + }, + "id": { + "description": "Cache key of the entity to evict, e.g. \"Post:5\".", + "type": "string" + }, + "type": { + "const": "evict", + "type": "string" + } + }, + "required": [ + "type", + "id", + "broadcast" + ], + "type": "object" + } +]
3 tool updates
v1.0.0- First observed
diagnose_cache_graph - First observed
inspect_dangling_refs - First observed
patch_cache
TDQS
The three tools map to distinct workflow phases: focused read-only audit, planning/diagnosis, and mutation. inspect_dangling_refs and diagnose_cache_graph overlap in that both return findings, but the descriptions clearly differentiate the focused audit from the full inspect-reason-plan pipeline.
All tool names follow a consistent snake_case verb_noun pattern: inspect_dangling_refs, patch_cache, diagnose_cache_graph. The verbs and noun objects are clear and predictable.
Three tools is a well-scoped size for a focused Apollo cache repair copilot. Each tool covers a meaningful stage of the workflow—diagnose, plan, patch—without redundancy or bloat.
The surface covers the full repair lifecycle: audit problems, generate a plan, and apply/validate repairs with dry-run and optional GC. There are no obvious dead ends for the stated purpose.
Maintenance
Related MCP Connectors
MCP server for Appcircle mobile CI/CD platform.
The official Planning Center MCP server for interacting with your ministry's data.
MCP server for Boson Protocol — on-chain agentic commerce for physical & digital goods.
Related MCP Servers
- AlicenseBqualityFmaintenanceAn MCP server that connects to your React Native application debugger22832MIT
- AlicenseNot gradedqualityBmaintenanceThis MCP server enables real-time debugging and inspection of running React Native apps, providing access to console logs, errors, network requests, navigation state, storage, and performance profiling.1MIT
- AlicenseAqualityCmaintenanceMCP server that gives AI coding agents hands, eyes and a mechanic's ear for React Native development.9142MIT
- AlicenseNot gradedqualityAmaintenanceA plugin-based MCP server for React Native runtime debugging, inspection, and automation via Chrome DevTools Protocol. Works with Expo, bare React Native, and any Metro + Hermes project without app code changes.59277MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/nihar777/apollo-cache-copilot'
If you have feedback or need assistance with the MCP directory API, please join our Discord server