Text parse unified patch

text-parse-unified-patch · version 1.0.0 · Text · free, no key needed

Parse a one-file unified patch into path names and 0-based hunks.

Use when you need to: text parse unified patch · parse unified diff · parse unified patch headers and hunks.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "unified": "--- a\n+++ b\n@@ -1,1 +1,1 @@\n-a\n+b\n"
}

Response:

{
  "result": {
    "from_name": "a",
    "to_name": "b",
    "hunks": [
      {
        "old_start": 0,
        "old_count": 1,
        "new_start": 0,
        "new_count": 1,
        "ops": [
          {
            "op": "delete",
            "value": {
              "text": "a",
              "eol": "\n"
            }
          },
          {
            "op": "insert",
            "value": {
              "text": "b",
              "eol": "\n"
            }
          }
        ]
      }
    ],
    "identical": false
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "text-parse-unified-patch",
  "version": "1.0.0",
  "input": {
    "unified": "--- a\n+++ b\n@@ -1,1 +1,1 @@\n-a\n+b\n"
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/text-parse-unified-patch/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"unified":"--- a\n+++ b\n@@ -1,1 +1,1 @@\n-a\n+b\n"}'

The machine-readable contract is at /v1/tools/text-parse-unified-patch/versions/1.0.0.

CLI

node cli.mjs run text-parse-unified-patch 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.