# Path lexical join

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

Join an array of path segments lexically, resolving absolute reset boundaries and normalizing separators.

**Use when you need to: path join · join path segments · concatenate path parts.**

## Supported

- path join
- join path segments
- concatenate path parts

## Not supported

- stat file
- resolve symlinks
- filesystem access

## Behavior

- Join segments left-to-right. If a segment is absolute (starts with /, , or drive:) it resets the base. Empty segments are treated as "." and skipped. The final joined path is lexically normalized.

## Input

- `segments` (array of string, required): min items 1; max items 64; each max length 4096
- `format` (one of "posix", "windows", "auto", optional)

## Output

- `joined` (string, required)
- `format` (string, required)
- `is_absolute` (boolean, required)

## Limits

- max segments: 64
- max segment bytes: 4096

## Example

Request input:

```json
{
  "segments": [
    "/usr/local",
    "bin",
    "node"
  ]
}
```

Response:

```json
{
  "result": {
    "joined": "/usr/local/bin/node",
    "format": "posix",
    "is_absolute": true
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "path-lexical-join",
  "version": "1.0.0",
  "input": {
    "segments": [
      "/usr/local",
      "bin",
      "node"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/path-lexical-join/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"segments":["/usr/local","bin","node"]}'
```

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

### CLI

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

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

## Related tools

- [Path lexical normalize](/tools/path-lexical-normalize): Normalize a path lexically: collapse redundant separators, resolve "." and ".." segments.
- [Path lexical common ancestor](/tools/path-lexical-common-ancestor): Compute the deepest common ancestor directory of a set of paths.
- [Path lexical contains](/tools/path-lexical-contains): Check whether a child path is lexically inside a parent directory.
- [Path lexical parse](/tools/path-lexical-parse): Decompose a file path into its lexical components without accessing the filesystem.
- [Path lexical relative](/tools/path-lexical-relative): Compute the lexical relative path from one path to another without filesystem access.
- [Path lexical sanitize](/tools/path-lexical-sanitize): Sanitize an untrusted path to produce a safe relative path, stripping roots, drive letters, traversal segments, and illegal characters.
