Skip to main content
Glama
nihar777

apollo-cache-copilot

Patch cache

patch_cache
Idempotent

Repair a serialized Apollo cache by applying modify/evict operations, optionally garbage-collecting orphaned refs, and returning the patched store. Use dryRun to validate changes before committing.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gcNoRun `cache.gc()` once after all operations land, to collect anything the patches orphaned.
cacheYesThe 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.
dryRunNoValidate `operations` and report what would happen without mutating the cache.
operationsYesOne or more modify/evict operations to apply, in order.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
cacheYesThe store after the operations landed. Unchanged when `dryRun` is true.
dryRunYesEchoes the request's dryRun — true means the cache was not actually touched.
resultsYesOne result per input operation, in the same order.
collectedYesCache keys removed by the trailing `gc()`, when it ran.

Schema Changelog

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

  1. Changed15 schema fields changedv1.0.2
    • addedInput schema / properties / cache / additionalProperties / description
      Added value: +"One normalized store entry: the raw field/value map Apollo keeps under a single cache key."
    • addedInput schema / properties / cache / description
      Added 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."
    • addedInput schema / properties / dryRun / description
      Added value: +"Validate `operations` and report what would happen without mutating the cache."
    • addedInput schema / properties / gc / description
      Added value: +"Run `cache.gc()` once after all operations land, to collect anything the patches orphaned."
    • addedInput schema / properties / operations / description
      Added value: +"One or more modify/evict operations to apply, in order."
    • changedInput schema / properties / operations / items / oneOf
      Previous 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"
      +  }
      +]
    • addedOutput schema / properties / cache / additionalProperties / description
      Added value: +"One normalized store entry: the raw field/value map Apollo keeps under a single cache key."
    • addedOutput schema / properties / cache / description
      Added value: +"The store after the operations landed. Unchanged when `dryRun` is true."
    • addedOutput schema / properties / collected / description
      Added value: +"Cache keys removed by the trailing `gc()`, when it ran."
    • addedOutput schema / properties / dryRun / description
      Added value: +"Echoes the request's dryRun — true means the cache was not actually touched."
    • addedOutput schema / properties / results / description
      Added value: +"One result per input operation, in the same order."
    • addedOutput schema / properties / results / items / properties / changed / description
      Added value: +"Whether `cache.modify` / `cache.evict` actually changed anything."
    • addedOutput schema / properties / results / items / properties / error / description
      Added value: +"Set when this one operation failed; the rest of the batch still ran."
    • addedOutput schema / properties / results / items / properties / operation / description
      Added value: +"The operation this result is reporting on, echoed back."
    • changedOutput schema / properties / results / items / properties / operation / oneOf
      Previous 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"
      +  }
      +]
  2. First observedv1.0.0

TDQS

A3.8/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines2/5

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.

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/nihar777/apollo-cache-copilot'

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