# Path set union

`path-set-union` · version 1.0.0 · File paths (lexical) · free, no key needed

Compute the set union of multiple path collections, normalized and deterministically sorted.

**Use when you need to: path set union · merge path sets · combine paths.**

## Supported

- path set union
- merge path sets
- combine paths

## Not supported

- stat file
- filesystem access

## Behavior

- Returns all unique paths across all input sets. If sort false: first-seen order. If sort true: lexicographic order of normalized paths.

## Input

- `sets` (array of array of string, required): min items 1; max items 10
- `format` (one of "posix", "windows", "auto", optional)
- `case_sensitive` (boolean, optional)
- `normalize` (boolean, optional)
- `sort` (boolean, optional)

## Output

- `union` (array of string, optional)
- `count` (integer, optional)
- `format` (string, optional)

## Limits

- max sets: 10
- max paths per set: 10000
- max path bytes: 4096

## Example

Request input:

```json
{
  "sets": [
    [
      "a.ts",
      "b.ts"
    ],
    [
      "b.ts",
      "c.ts"
    ]
  ]
}
```

Response:

```json
{
  "result": {
    "union": [
      "a.ts",
      "b.ts",
      "c.ts"
    ],
    "count": 3,
    "format": "posix"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "path-set-union",
  "version": "1.0.0",
  "input": {
    "sets": [
      [
        "a.ts",
        "b.ts"
      ],
      [
        "b.ts",
        "c.ts"
      ]
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/path-set-union/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"sets":[["a.ts","b.ts"],["b.ts","c.ts"]]}'
```

The machine-readable contract is at [/v1/tools/path-set-union/versions/1.0.0](/v1/tools/path-set-union/versions/1.0.0).

### CLI

```sh
node cli.mjs run path-set-union 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Path set difference](/tools/path-set-difference): Compute the set difference (A \ B) of two path collections using lexical path equivalence.
- [Path set intersection](/tools/path-set-intersection): Compute the set intersection of multiple path collections using lexical path equivalence.
- [Path set classify](/tools/path-set-classify): Classify an array of file paths by file extension, depth histogram, and path format.
- [Path set dedupe](/tools/path-set-dedupe): Deduplicate an array of paths based on lexical equivalence while preserving first or last seen order.
- [Path set glob filter](/tools/path-set-glob-filter): Filter an array of paths against glob patterns with inclusion and exclusion rules lexically without filesystem access.
- [Path set hierarchy tree](/tools/path-set-hierarchy-tree): Transform a flat array of file paths into a nested deterministic directory tree structure.
