# Path set glob filter

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

Filter an array of paths against glob patterns with inclusion and exclusion rules lexically without filesystem access.

**Use when you need to: glob filter paths · filter files by glob · include exclude paths by pattern.**

## Supported

- glob filter paths
- filter files by glob
- include exclude paths by pattern

## Not supported

- filesystem glob
- readdir
- stat file
- filesystem access

## Behavior

- Patterns starting with ! are negation/exclusion patterns. A path is included if it matches at least one include pattern AND does NOT match any exclusion pattern. If there are ONLY exclusion patterns, start with all paths included then exclude.

## Input

- `paths` (array of string, required): min items 0; max items 10000
- `patterns` (array of string, required): min items 1; max items 256
- `dot` (boolean, optional)
- `case_sensitive` (boolean, optional)
- `format` (one of "posix", "windows", "auto", optional)

## Output

- `matched` (array of string, optional)
- `excluded` (array of string, optional)
- `format` (string, optional)

## Limits

- max paths: 10000
- max patterns: 256
- max path bytes: 4096
- max pattern bytes: 512

## Example

Request input:

```json
{
  "paths": [
    "src/a.ts",
    "src/b.js",
    "test/c.ts"
  ],
  "patterns": [
    "**/*.ts"
  ]
}
```

Response:

```json
{
  "result": {
    "matched": [
      "src/a.ts",
      "test/c.ts"
    ],
    "excluded": [
      "src/b.js"
    ],
    "format": "posix"
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "path-set-glob-filter",
  "version": "1.0.0",
  "input": {
    "paths": [
      "src/a.ts",
      "src/b.js",
      "test/c.ts"
    ],
    "patterns": [
      "**/*.ts"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/path-set-glob-filter/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"paths":["src/a.ts","src/b.js","test/c.ts"],"patterns":["**/*.ts"]}'
```

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

### CLI

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

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

## Related tools

- [Path set partition directory](/tools/path-set-partition-directory): Partition an array of file paths into buckets grouped by parent directory or directory at a specified depth.
- [Path set ignore filter](/tools/path-set-ignore-filter): Filter paths against gitignore-style rule lines (negation, comments, directory trailing slashes) lexically.
- [Path set minimal covering](/tools/path-set-minimal-covering): Find the minimal covering set of paths by collapsing child paths when an ancestor path is already in the set.
- [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 difference](/tools/path-set-difference): Compute the set difference (A \ B) of two path collections using lexical path equivalence.
