# Glob Pattern Tester MCP

> Glob Pattern Tester checks if any given file path matches complex glob patterns using the exact algorithm found in npm and git. This is essential for validating everything from .gitignore rules to CI/CD pipeline includes. Don't guess whether a pattern like `src/**/*.ts` covers `src/utils/helper.ts`; let this MCP give you a definitive, reliable boolean match result.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** pattern-matching, file-system, automation, regex, path-validation, devops-utilities

## Description

Writing build scripts or setting up deployment filters means dealing with path patterns constantly. You need to know if your file structure matches the rules defined in a configuration file—and guessing is a recipe for broken builds. This connector gives your agent the definitive answer. It uses the same matching engine trusted by industry tools like npm and git, so you never have to worry about pattern drift or inaccurate logic. When you connect this MCP through Vinkius, your agent can treat path validation as a reliable function call, verifying whether a file actually adheres to complex patterns using full support for wildcards, negation, and grouping. This capability stops entire classes of build failures before they even start.

## Tools

### test_glob
Pass a glob pattern and file path to confirm if the path matches, using npm's exact matching algorithm.

## Prompt Examples

**Prompt:** 
```
Does the pattern src/**/*.ts match the file src/utils/helper.ts?
```

**Response:** 
```
Glob Match Result: matches = true
```

**Prompt:** 
```
Check if *.json matches package.json in the root.
```

**Response:** 
```
Glob Match Result: matches = true
```

**Prompt:** 
```
Will !dist/** exclude the file dist/bundle.js?
```

**Response:** 
```
Glob Match Result: matches = false (negated)
```

## Capabilities

### Validate File Path Matching
Tests if a given string (the file path) is included in the set defined by a glob pattern.

### Handle Complex Wildcards
Supports standard glob characters, including `*` for any character sequence, `?` for a single character, and `**` for directory recursion.

### Process Exclusions
Allows testing patterns with negation (`!`) to determine if a file path explicitly fails to match a rule set.

## Use Cases

### Updating a .gitignore File
A developer is adding new build artifacts to `.gitignore`. Instead of committing the rule and waiting for a failure, they ask their agent: 'Does the pattern `*.log` exclude all files in the `build/` directory?' The agent uses `test_glob` to return a definitive match result, confirming the exclusion works before they push code.

### Verifying Asset Inclusion for Deployment
The ops engineer needs to ensure all compiled components are included in the deployment package. They ask: 'Will `src/**/*.js` match the path `dist/utils/helper.js`?' The agent uses `test_glob` to confirm the file exists within the scope of the build pattern, preventing missing assets.

### Troubleshooting CI Build Failures
A pipeline fails because a specific asset is being ignored. The user runs: 'Check if `!src/api/**` excludes the file `src/api/v2/users.ts`?' Using `test_glob`, the agent confirms whether the exclusion rule was too broad or incorrectly structured.

### Testing Manifest File Generation
A platform developer writes a manifest that relies on glob patterns to find all dependencies. They run: 'Does `lib/**` match `lib/core/index.js`?' The agent uses `test_glob` to validate the pattern immediately, ensuring the build script won't miss any files.

## Benefits

- Stop guessing if a file matches a build rule. Use the `test_glob` tool to confirm path validity using the same logic npm and git use, eliminating guesswork.
- Manage complex exclusions reliably. You can test negation patterns (like `!dist/**`) to ensure files are correctly skipped during deployment filtering.
- Save time debugging flaky pipelines. By testing paths upfront with `test_glob`, your agent verifies rules before the build even starts failing.
- Handle deep directory structures easily. The support for recursive globbing (`**`) ensures that patterns like `src/**/*.ts` cover all files, no matter how deep they are nested.
- Build robust CI/CD logic. When integrating this MCP via Vinkius, your agent can verify file system rules and path validation data in any autonomous code workflow.

## How It Works

The bottom line is that you get an immediate, deterministic yes or no answer on whether your path rules are correct.

1. You provide the agent with two specific strings: the pattern (e.g., `src/**/*.js`) and the target file path (e.g., `src/components/Button.js`).
2. The MCP executes its built-in matching logic, simulating how a major build tool processes the rule set against the file system.
3. Your agent receives a simple boolean result: `true` if the file matches the pattern, or `false` otherwise.

## Frequently Asked Questions

**Does Glob Pattern Tester handle recursive directories?**
Yes, it supports full recursion using the `**` wildcard. This lets you write patterns like `src/**/*.ts`, ensuring that every TypeScript file in every subdirectory is matched.

**Can I use ! with Glob Pattern Tester for exclusions?**
Absolutely. You can test exclusion rules by including the negation operator (`!`). This helps confirm if a specific path will be explicitly skipped by your build system's logic.

**Is the glob matching in Glob Pattern Tester the same as git?**
Yes. The MCP uses the `minimatch` engine, which is the exact engine behind npm and Git. This guarantees that the validation result you get matches what those tools use.

**How do I test a simple file match with Glob Pattern Tester?**
You provide the pattern (e.g., `*.json`) and the path (`package.json`). The agent will run this through `test_glob` and return `true` if it matches, or `false` if it doesn't.

**How does the `test_glob` function handle malformed patterns or file paths?**
It handles bad inputs gracefully by returning a specific error message. The MCP won't crash; it reports invalid input, allowing your agent to know exactly what went wrong with the pattern string.

**Does `test_glob` require absolute paths or relative paths for accurate results?**
Relative paths are fine, provided they maintain consistent separators. Since the engine matches strings, as long as both inputs use the same path separator (like `/`), you'll get a reliable match result.

**How efficient is `test_glob` when I check patterns against hundreds of files?**
It performs quickly because it relies on the highly optimized minimatch engine. The performance scales well, making it suitable for bulk validation tasks in CI/CD pipelines.

**What kind of data types are accepted by `test_glob`?**
The tool accepts both the glob pattern and the file path as standard strings. It's designed for string-based text matching, useful for validating anything that follows a path structure.

**Is this the same algorithm git uses?**
Yes. minimatch is the glob engine used by npm itself and follows the same POSIX glob specification that git uses for .gitignore.

**Does it support double-star recursive patterns?**
Yes. The `**` pattern matches any number of directories recursively. For example, `src/**/*.ts` matches files at any depth inside `src/`.

**Can I test negation patterns?**
Yes. Prefix any pattern with `!` to negate it. For example, `!node_modules/**` will NOT match any path inside node_modules.