# ContextSlim MCP API – Fetch Cached Context (GET)

> ContextSlim MCP API – Fetch Cached Context (GET) is a paid API for AI agents from contextslim.friczero.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Retrieves a previously optimized and cached context payload using a reference ID returned by the optimize_context tool.

## Facts

- Endpoint: GET https://contextslim.friczero.com/message
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/contextslim-mcp-api-fetch-cached-context-get-3fa98072
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_PaynaEzA2JM2wvPhkA1mF

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability contextslim-mcp-api-fetch-cached-context-get-3fa98072
```

Example prompt: Fetch the cached context result with reference ID 'ref_12345678' so I can continue the conversation using the previously pruned payload without re-running the full optimization.

## When to prefer this

Use this endpoint when an agent has already called optimize_context and received a referenceId, and now needs to retrieve the cached pruned payload — especially across conversation turns or pipeline steps. Prefer this over re-running optimization when the cached result is still within its TTL, to save tokens and cost. Ideal for multi-turn LLM agents and long-running workflows where re-transmitting full JSON is prohibitive.

## Known failure modes

- Missing or invalid referenceId returns an error — the referenceId query parameter is required and must be non-empty
- Expired referenceId (past 3600s TTL) returns a cache miss or not-found error
- Invalid or malformed MCP method enum value causes a schema validation error
- Payment failure or missing x402 header results in a 402 Payment Required response
- Network timeout or upstream KV cache unavailability causes a 5xx error

## How this service works

[MCP: optimize_context] Pay-per-call JSON context pruning & LLM token budget enforcement. Saves up to 85% prompt tokens.

## Output

Returns the pruned JSON payload previously generated by optimize_context, along with token metrics (original tokens, slimmed tokens, tokens saved, reduction percentage, strategy applied) and a tool result reference object containing the referenceId, fetchTool name, and expiry duration. Delivered as a JSON object with a 'success' status field.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "result": {},
  "status": "success",
  "metrics": {
   "savedTokens": 528,
   "slimmedTokens": 94,
   "originalTokens": 622,
   "strategyApplied": "prune_arrays",
   "reductionPercentage": "84.9%"
  },
  "toolResultReference": {
   "expiresIn": "3600s",
   "fetchTool": "fetch_result",
   "referenceId": "ref_12345678"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/contextslim-mcp-api-fetch-cached-context-get-3fa98072/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from contextslim.friczero.com](https://www.zero.xyz/host/contextslim.friczero.com/llms.txt)
