# RAG Context Sanitizer

> RAG Context Sanitizer is a paid API for AI agents from mcp-gateway.agentdiet.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-22).

Sanitizes and compresses raw text input for RAG pipelines, returning cleaned context with a compression ratio proof

## Facts

- Endpoint: GET https://mcp-gateway.agentdiet.dev/v1/workflows/rag-context-sanitizer?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/rag-context-sanitizer-37420732
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YpLHOTBTLa-UvWqqyBdHt

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 rag-context-sanitizer-37420732
```

Example prompt: Can you sanitize this retrieved context text before I pass it to the LLM? Here's the raw chunk: 'The quick brown fox... [repeated boilerplate, noise, irrelevant headers]' — I need it cleaned and compressed.

## When to prefer this

Choose this endpoint when you need a lightweight, pay-per-use text sanitization step specifically optimized for RAG context windows, with verifiable compression metrics. Prefer it over manual preprocessing when you want a deterministic, auditable compression ratio proof for your pipeline, or when operating in an agent-to-agent (A2A) workflow that requires x402 micropayment settlement on Base.

## Known failure modes

- Missing required 'text' query parameter returns an error or empty data
- Input text that is already clean may return near-zero compression with minimal transformation
- Oversized text inputs may be truncated or rejected
- Payment failure (insufficient USDC balance) results in HTTP 402 and no processing
- Network timeout on large text inputs
- Malformed input schema returns validation error

## How this service works

Deterministic B2A/A2A/MCP/x402/MPP/L402 execution and intelligence node at https://mcp-gateway.agentdiet.dev settling in USDC on Base.

## Output

Returns a JSON object with a 'data' field containing the sanitized/compressed output text, a 'status' field ('ok' on success), and an 'roi_proof' object that includes a 'compression_ratio_pct' value (e.g. 91.4) indicating how much the input was compressed.

## 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",
      "POST"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "text": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {},
  "status": "ok",
  "roi_proof": {
   "compression_ratio_pct": 91.4
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/rag-context-sanitizer-37420732/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from mcp-gateway.agentdiet.dev](https://www.zero.xyz/host/mcp-gateway.agentdiet.dev/llms.txt)
