Path lexical common ancestor

path-lexical-common-ancestor · version 1.0.0 · File paths (lexical) · free, no key needed

Compute the deepest common ancestor directory of a set of paths.

Use when you need to: common ancestor · longest common path prefix · shared ancestor directory.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "paths": [
    "/a/b/c",
    "/a/b/d",
    "/a/b/e/f"
  ]
}

Response:

{
  "result": {
    "ancestor": "/a/b",
    "format": "posix",
    "depth": 2
  }
}

How to call it

MCP

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

{
  "id": "path-lexical-common-ancestor",
  "version": "1.0.0",
  "input": {
    "paths": [
      "/a/b/c",
      "/a/b/d",
      "/a/b/e/f"
    ]
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/path-lexical-common-ancestor/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"paths":["/a/b/c","/a/b/d","/a/b/e/f"]}'

The machine-readable contract is at /v1/tools/path-lexical-common-ancestor/versions/1.0.0.

CLI

node cli.mjs run path-lexical-common-ancestor 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.