{
  "x402Version": 2,
  "service": "trace-diet",
  "title": "Trace Diet — HAR & Log Context Distiller API",
  "version": "1.0.0",
  "mcpEndpoint": "https://trace-diet.apikeg.com/mcp",
  "freeDiscovery": [
    "https://trace-diet.apikeg.com/llms.txt",
    "https://trace-diet.apikeg.com/llms-full.txt",
    "https://trace-diet.apikeg.com/openapi.json",
    "https://trace-diet.apikeg.com/.well-known/mcp.json",
    "https://trace-diet.apikeg.com/.well-known/api-catalog"
  ],
  "resources": [
    {
      "name": "distill_har_capture",
      "title": "Distill & Scrub HAR Network Capture",
      "url": "https://trace-diet.apikeg.com/v1/distill-har-capture",
      "method": "POST",
      "description": "Parses Chrome DevTools / Playwright .har captures, strips static assets (.js/.css/fonts/images), analytics beacons, and OPTIONS preflights, scrubs credentials (Authorization, Cookie, Set-Cookie, X-Api-Key, token params, JWTs) into [REDACTED:<type>], groups dynamic :id/:uuid routes and polling loops, surfaces 4xx/5xx failures and slowestEndpoints, and infers compact TypeScript request/response schemas. Why call instead of DIY: Replaces ad-hoc jq/Python HAR scripts that miss base64 bodies, leak Bearer JWTs/cookies into LLM prompts, or fail to merge nullable JSON types across repeated API calls. Pricing: $0.002 base (up to $0.008 max ($0.002 base + $0.001 per 250KB of .har input, capped at $0.008), x402 variable settlement). Pass ?dry_run=true on REST to validate schema free.",
      "accepts": [
        {
          "scheme": "upto",
          "network": "eip155:8453",
          "amount": "8000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x000000000000000000000000000000000000dEaD",
          "maxTimeoutSeconds": 60,
          "extra": {
            "priceUsd": "0.002",
            "maxPriceUsd": "0.008",
            "unitDescription": "($0.002 base + $0.001 per 250KB of .har input, capped at $0.008)",
            "dryRunQueryParam": "?dry_run=true"
          }
        }
      ],
      "extensions": {
        "bazaar": {
          "discoverable": true,
          "category": [
            "developer-tools",
            "observability",
            "context-optimization",
            "security-hygiene"
          ],
          "info": {
            "input": {
              "type": "http",
              "method": "POST",
              "bodyType": "json",
              "example": {
                "redactSecrets": true,
                "inferSchemas": true,
                "includeStaticAssets": false,
                "includeTelemetry": false,
                "includeOptionsPreflight": false,
                "maxFailureBodyChars": 512,
                "maxSlowestEndpoints": 10,
                "har": {
                  "log": {
                    "version": "1.2",
                    "entries": [
                      {
                        "startedDateTime": "2026-11-30T08:15:00.000Z",
                        "time": 412,
                        "request": {
                          "method": "POST",
                          "url": "https://api.shop.io/users/94821/orders/550e8400-e29b-41d4-a716-446655440000?api_key=live_secret",
                          "headers": [
                            {
                              "name": "Authorization",
                              "value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5NDgyMSJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
                            }
                          ],
                          "postData": {
                            "mimeType": "application/json",
                            "text": "{\"sku\":\"PRO-ANNUAL\",\"Seats\":5}"
                          }
                        },
                        "response": {
                          "status": 500,
                          "statusText": "Internal Server Error",
                          "headers": [
                            {
                              "name": "Content-Type",
                              "value": "application/json"
                            }
                          ],
                          "content": {
                            "mimeType": "application/json",
                            "text": "{\"error\":\"stripe_upstream_timeout\",\"retryable\":true}"
                          }
                        }
                      }
                    ]
                  }
                }
              }
            },
            "output": {
              "type": "json",
              "summary": "1 grouped endpoint POST https://api.shop.io/users/:id/orders/:uuid, 1 failure with redacted JWT + api_key, and inferred TypeScript Request/Error interfaces."
            }
          },
          "schema": {
            "inputSchema": {
              "type": "object",
              "properties": {
                "har": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": true,
                  "description": "Parsed HAR 1.2 JSON object containing log.entries (exported from Chrome DevTools, Playwright, or mitmproxy)."
                },
                "harJson": {
                  "type": "string",
                  "minLength": 2,
                  "maxLength": 5000000,
                  "description": "Raw serialized .har JSON text when passing unparsed file contents directly."
                },
                "includeStaticAssets": {
                  "type": "boolean",
                  "default": false,
                  "description": "Keep static asset requests (.js, .css, .woff2, .png, .svg, .ico, images/fonts). Defaults to false."
                },
                "includeTelemetry": {
                  "type": "boolean",
                  "default": false,
                  "description": "Keep analytics and telemetry beacons (Google Analytics, Segment, Datadog, Sentry, Mixpanel). Defaults to false."
                },
                "includeOptionsPreflight": {
                  "type": "boolean",
                  "default": false,
                  "description": "Keep CORS OPTIONS preflight requests. Defaults to false."
                },
                "redactSecrets": {
                  "type": "boolean",
                  "default": true,
                  "description": "Scrub Authorization, Cookie, Set-Cookie, X-Api-Key, api_key/token query params, and JWTs into [REDACTED:<type>]."
                },
                "inferSchemas": {
                  "type": "boolean",
                  "default": true,
                  "description": "Infer compact TypeScript interfaces/types for JSON request and response payloads across endpoint calls."
                },
                "maxFailureBodyChars": {
                  "type": "integer",
                  "default": 512,
                  "minimum": 64,
                  "maximum": 4096,
                  "description": "Maximum characters retained per 4xx/5xx/network failure body snippet."
                },
                "maxSlowestEndpoints": {
                  "type": "integer",
                  "default": 10,
                  "minimum": 1,
                  "maximum": 50,
                  "description": "Maximum number of slowest endpoints ranked by p95 latency."
                },
                "allowedHosts": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "maxItems": 50,
                  "description": "Optional hostname allowlist (e.g. ['api.acme.com']) to isolate target traffic."
                }
              },
              "additionalProperties": false
            },
            "outputSchema": {
              "type": "object",
              "required": [
                "ok",
                "data",
                "_meta"
              ],
              "properties": {
                "ok": {
                  "type": "boolean",
                  "const": true
                },
                "data": {
                  "type": "object",
                  "description": "Deterministic structured tool result payload."
                },
                "_meta": {
                  "type": "object",
                  "required": [
                    "requestId",
                    "durationMs",
                    "chargedUsd",
                    "dryRun"
                  ],
                  "properties": {
                    "requestId": {
                      "type": "string"
                    },
                    "durationMs": {
                      "type": "number"
                    },
                    "chargedUsd": {
                      "type": "string"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    {
      "name": "cluster_logs",
      "title": "Cluster Noisy Logs via Drain Prefix-Tree",
      "url": "https://trace-diet.apikeg.com/v1/cluster-logs",
      "method": "POST",
      "description": "Folds multi-line stack traces (JS/Java 'at ...', Python Traceback, Go panics, Java 'Caused by:'), parses plain-text, Docker/Kubernetes CRI, and NDJSON logs, pre-masks <UUID>/<IP>/<HEX>/<ISO_TS>/<URL>/<NUM>, and runs a fixed-depth Drain prefix-tree clusterer to collapse 50,000+ log lines by 95–99% with errorClusters highlighted first. Why call instead of DIY: Avoids naive grep/head truncation that misses rare fatal stack traces buried at line 41,000, cutting 500k-token log dumps to ~2k tokens in <50ms. Pricing: $0.002 base (up to $0.008 max ($0.002 base + $0.001 per 2,000 log lines, capped at $0.008), x402 variable settlement). Pass ?dry_run=true on REST to validate schema free.",
      "accepts": [
        {
          "scheme": "upto",
          "network": "eip155:8453",
          "amount": "8000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x000000000000000000000000000000000000dEaD",
          "maxTimeoutSeconds": 60,
          "extra": {
            "priceUsd": "0.002",
            "maxPriceUsd": "0.008",
            "unitDescription": "($0.002 base + $0.001 per 2,000 log lines, capped at $0.008)",
            "dryRunQueryParam": "?dry_run=true"
          }
        }
      ],
      "extensions": {
        "bazaar": {
          "discoverable": true,
          "category": [
            "developer-tools",
            "observability",
            "context-optimization",
            "security-hygiene"
          ],
          "info": {
            "input": {
              "type": "http",
              "method": "POST",
              "bodyType": "json",
              "example": {
                "similarityThreshold": 0.6,
                "treeDepth": 4,
                "maxClusters": 300,
                "maxReturnedClusters": 100,
                "maxStackTraceChars": 1500,
                "logs": "2026-11-30T08:00:01.100Z INFO [http] GET /healthz from 10.244.1.8 completed in 2ms\n2026-11-30T08:00:02.100Z INFO [http] GET /healthz from 10.244.1.9 completed in 3ms\n2026-11-30T08:00:03.250Z ERROR [db] Deadlock detected for tx 550e8400-e29b-41d4-a716-446655440000 after 3 retries\n    at PoolClient.query (/srv/app/db.ts:118:13)\n    at OrderRepo.commit (/srv/app/orders.ts:74:9)"
              }
            },
            "output": {
              "type": "json",
              "summary": "Highlights 1 ERROR cluster (with folded stack trace) ahead of 1 INFO template (<IP>, <NUM> masked)."
            }
          },
          "schema": {
            "inputSchema": {
              "type": "object",
              "properties": {
                "logs": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 5000000,
                  "description": "Raw plain-text, Docker/Kubernetes CRI, or newline-delimited JSON (ndjson) log stream."
                },
                "lines": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 32768
                  },
                  "minItems": 1,
                  "maxItems": 100000,
                  "description": "Pre-split array of log lines (alternative to passing a single 'logs' string)."
                },
                "similarityThreshold": {
                  "type": "number",
                  "default": 0.6,
                  "minimum": 0.2,
                  "maximum": 1,
                  "description": "Drain token-similarity threshold [0.2-1.0] required to merge a log line into an existing canonical template."
                },
                "treeDepth": {
                  "type": "integer",
                  "default": 4,
                  "minimum": 3,
                  "maximum": 8,
                  "description": "Fixed Drain prefix-tree depth (length -> leading tokens -> leaf templates)."
                },
                "maxClusters": {
                  "type": "integer",
                  "default": 300,
                  "minimum": 10,
                  "maximum": 1000,
                  "description": "Maximum canonical Drain clusters maintained before routing outliers to overflow."
                },
                "maxReturnedClusters": {
                  "type": "integer",
                  "default": 100,
                  "minimum": 1,
                  "maximum": 500,
                  "description": "Maximum ranked clusters returned in the response payload."
                },
                "maxStackTraceChars": {
                  "type": "integer",
                  "default": 1500,
                  "minimum": 128,
                  "maximum": 8192,
                  "description": "Maximum characters retained per cluster sampleStackTrace."
                }
              },
              "additionalProperties": false
            },
            "outputSchema": {
              "type": "object",
              "required": [
                "ok",
                "data",
                "_meta"
              ],
              "properties": {
                "ok": {
                  "type": "boolean",
                  "const": true
                },
                "data": {
                  "type": "object",
                  "description": "Deterministic structured tool result payload."
                },
                "_meta": {
                  "type": "object",
                  "required": [
                    "requestId",
                    "durationMs",
                    "chargedUsd",
                    "dryRun"
                  ],
                  "properties": {
                    "requestId": {
                      "type": "string"
                    },
                    "durationMs": {
                      "type": "number"
                    },
                    "chargedUsd": {
                      "type": "string"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  ]
}