{
  "x402Version": 2,
  "service": "doc-redline",
  "title": "Document Redline & Table Diff Edge API",
  "version": "1.0.0",
  "mcpEndpoint": "https://doc-redline.apikeg.com/mcp",
  "freeDiscovery": [
    "https://doc-redline.apikeg.com/llms.txt",
    "https://doc-redline.apikeg.com/llms-full.txt",
    "https://doc-redline.apikeg.com/openapi.json",
    "https://doc-redline.apikeg.com/.well-known/mcp.json",
    "https://doc-redline.apikeg.com/.well-known/api-catalog"
  ],
  "resources": [
    {
      "name": "diff_documents",
      "title": "Redline & Audit Two Document Versions",
      "url": "https://doc-redline.apikeg.com/v1/diff-documents",
      "method": "POST",
      "description": "Runs two-level Myers O(ND) section/paragraph and inline word-and-punctuation diffing across two document versions, returning sectionBreadcrumb-tagged hunks, CriticMarkup ({--old--}{++new++}), inline HTML (<del>/<ins>), dedicated numericAndDateChanges alerts, and optional native .docx Track Changes. Why call instead of DIY: Eliminates 95% of unchanged context tokens on multi-section specs/RFPs/SOWs, catches every altered number/currency/duration/date deterministically, and packages valid ECMA-376 .docx Track Changes ZIP archives on the edge. Pricing: $0.002 USD per document redline comparison (x402 instant micropayment). Pass ?dry_run=true on REST to validate schema free.",
      "accepts": [
        {
          "scheme": "exact",
          "network": "eip155:8453",
          "amount": "2000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x000000000000000000000000000000000000dEaD",
          "maxTimeoutSeconds": 60,
          "extra": {
            "priceUsd": "0.002",
            "unitDescription": "per document redline comparison",
            "dryRunQueryParam": "?dry_run=true"
          }
        }
      ],
      "extensions": {
        "bazaar": {
          "discoverable": true,
          "category": [
            "document-processing",
            "procurement-ops",
            "revops",
            "developer-tools"
          ],
          "info": {
            "input": {
              "type": "http",
              "method": "POST",
              "bodyType": "json",
              "example": {
                "original": "# Statement of Work\n\n## Section 4.2: Payment Terms\nCustomer shall pay all undisputed invoices within 30 days of receipt at $150/hour.",
                "revised": "# Statement of Work\n\n## Section 4.2: Payment Terms\nCustomer shall pay all undisputed invoices within 45 days of receipt at $175/hour.",
                "changedHunksOnly": true,
                "contextParagraphs": 0,
                "ignoreWhitespace": true,
                "includeDocxTrackChanges": true,
                "docxAuthor": "Procurement Ops Bot"
              }
            },
            "output": {
              "type": "json",
              "summary": "1 changed hunk under 'Statement of Work > Section 4.2: Payment Terms', 2 numericAndDateChanges ('30 days' -> '45 days', '$150' -> '$175'), and a valid base64 .docx with <w:del> and <w:ins>."
            }
          },
          "schema": {
            "inputSchema": {
              "type": "object",
              "properties": {
                "original": {
                  "type": "string",
                  "maxLength": 900000,
                  "description": "Baseline/original document text or Markdown (e.g. RFP, SOW, specification, SLA, or policy v1)."
                },
                "revised": {
                  "type": "string",
                  "maxLength": 900000,
                  "description": "Revised/updated document text or Markdown to compare deterministically against original."
                },
                "changedHunksOnly": {
                  "type": "boolean",
                  "default": true,
                  "description": "When true (default), omits 100% identical sections from hunks, criticMarkup, and htmlRedline so multi-page documents shrink by 90-98% in tokens."
                },
                "contextParagraphs": {
                  "type": "integer",
                  "default": 0,
                  "minimum": 0,
                  "maximum": 5,
                  "description": "Number of surrounding unchanged paragraphs to include around each changed hunk (0-5)."
                },
                "ignoreWhitespace": {
                  "type": "boolean",
                  "default": true,
                  "description": "Normalize repeated inline whitespace when aligning paragraphs while preserving exact text inside word-level diffs."
                },
                "includeDocxTrackChanges": {
                  "type": "boolean",
                  "default": false,
                  "description": "When true, generates a base64 OpenXML .docx archive containing native Microsoft Word Track Changes (<w:ins> and <w:del>/<w:delText>) for Accept/Reject review."
                },
                "docxAuthor": {
                  "type": "string",
                  "default": "API Keg Redline Engine",
                  "maxLength": 120,
                  "description": "Author attribution recorded on OpenXML <w:ins> and <w:del> Track Changes tags when includeDocxTrackChanges is true."
                },
                "docxTitle": {
                  "type": "string",
                  "maxLength": 200,
                  "description": "Optional document title stored in .docx Dublin Core package metadata."
                }
              },
              "required": [
                "original",
                "revised"
              ],
              "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": "diff_tables",
      "title": "Compare Two Structured CSV or JSON Tables by Primary Key",
      "url": "https://doc-redline.apikeg.com/v1/diff-tables",
      "method": "POST",
      "description": "Compares two JSON object arrays or RFC 4180 CSV strings keyed by a single or composite primaryKey, returning exact summary counts, added rows, removed rows, and cell-level modified diffs with exact decimal numericDelta. Why call instead of DIY: Avoids row-order false positives in line-based diffs and floating-point drift on price/inventory catalogs; supports composite keys like ['sku', 'region'] in <10ms. Pricing: $0.002 USD per structured table or catalog diff (x402 instant micropayment). Pass ?dry_run=true on REST to validate schema free.",
      "accepts": [
        {
          "scheme": "exact",
          "network": "eip155:8453",
          "amount": "2000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x000000000000000000000000000000000000dEaD",
          "maxTimeoutSeconds": 60,
          "extra": {
            "priceUsd": "0.002",
            "unitDescription": "per structured table or catalog diff",
            "dryRunQueryParam": "?dry_run=true"
          }
        }
      ],
      "extensions": {
        "bazaar": {
          "discoverable": true,
          "category": [
            "document-processing",
            "procurement-ops",
            "revops",
            "developer-tools"
          ],
          "info": {
            "input": {
              "type": "http",
              "method": "POST",
              "bodyType": "json",
              "example": {
                "primaryKey": [
                  "sku",
                  "region"
                ],
                "csvDelimiter": ",",
                "coerceCsvTypes": true,
                "numericTolerance": 0,
                "before": "sku,region,price,stock\nPRO-100,US,49.99,120\nPRO-100,EU,54.99,80\nLEGACY-1,US,19.00,10",
                "after": "sku,region,price,stock\nPRO-100,US,59.99,95\nPRO-100,EU,54.99,80\nNEW-200,US,99.00,250"
              }
            },
            "output": {
              "type": "json",
              "summary": "unchangedCount=1, addedCount=1 (NEW-200::US), removedCount=1 (LEGACY-1::US), modifiedCount=1 (PRO-100::US price +10, stock -25)."
            }
          },
          "schema": {
            "inputSchema": {
              "type": "object",
              "properties": {
                "before": {
                  "description": "Table dataset passed either as a JSON array of row objects (e.g. [{\"sku\":\"A1\",\"region\":\"US\",\"price\":49.99}]) or an RFC 4180 CSV string with a header row."
                },
                "after": {
                  "description": "Table dataset passed either as a JSON array of row objects (e.g. [{\"sku\":\"A1\",\"region\":\"US\",\"price\":49.99}]) or an RFC 4180 CSV string with a header row."
                },
                "primaryKey": {
                  "description": "Single primary-key column name (e.g. \"sku\") or composite primary-key column list (e.g. [\"sku\", \"region\"])."
                },
                "ignoreFields": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "maxItems": 64,
                  "description": "Optional column names (such as \"updated_at\" or \"etag\") to exclude from cell comparison."
                },
                "csvDelimiter": {
                  "type": "string",
                  "default": ",",
                  "minLength": 1,
                  "maxLength": 1,
                  "description": "Single-character column delimiter used when before or after is a CSV string (default ',')."
                },
                "coerceCsvTypes": {
                  "type": "boolean",
                  "default": true,
                  "description": "Automatically parse unquoted numeric and boolean literals in CSV cells while preserving leading-zero identifiers."
                },
                "numericTolerance": {
                  "type": "number",
                  "default": 0,
                  "minimum": 0,
                  "maximum": 1000000,
                  "description": "Optional non-negative tolerance; numeric cell differences with |delta| <= numericTolerance are treated as unchanged."
                }
              },
              "required": [
                "before",
                "after",
                "primaryKey"
              ],
              "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"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  ]
}