Skip to main content
Glama
crisjonblvx

enrichrapi-mcp

by crisjonblvx

validate_regex

Validate a regex pattern by testing it against a string, returning match positions, capture groups, and named groups. Use flags and max matches to control results.

Instructions

Test a regex pattern against a string and return all matches.

Compiles the pattern with optional flags, then returns every match with its start/end positions, capture groups, and named groups.

Args: pattern: The regex pattern to compile (e.g. r"\d+") test_string: The string to match against flags: Optional list of flag letters: "i" (ignore case), "m" (multiline), "s" (dotall), "x" (verbose) max_matches: Maximum number of matches to return, 1–200 (default 50)

Returns: dict with keys: valid_pattern, pattern, is_match, match_count, first_match, matches (list with start/end/groups), cost_usd

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flagsNo
patternYes
max_matchesNo
test_stringYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, but the description carries the burden well: it discloses compilation with optional flags, the match result structure (start/end, capture groups, named groups), and the full return dict including valid_pattern and cost_usd. It doesn't explicitly state invalid-pattern handling beyond the valid_pattern key, but this is a modest gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The summary sentence front-loads the purpose, followed by a compact Args block and a Returns list. Each section earns its place, and the flag/max_matches details are concise rather than padded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description includes the complete return contract (keys and match structure) plus all parameter constraints. Minor omissions like exact invalid-pattern error behavior prevent a perfect score, but the tool is fully callable from this description alone.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description provides all parameter semantics: pattern with an example, test_string purpose, flags with allowed letters and meanings, and max_matches with range and default. This fully compensates for the sparse schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Test') and resource ('a regex pattern against a string'), and details what it returns (all matches with positions, capture groups, named groups). This clearly differentiates it from sibling validation tools like validate_domain or validate_uuid, which target different resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly establishes the tool's context: testing a regex pattern against a string and returning matches. It doesn't explicitly discuss alternatives or exclusions, but the purpose is specific enough that an agent can route to it over the validation siblings without confusion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.