Skip to main content
Glama
regexlab-mcp
by 0xmortuex

test_regex

Run a regex against text in real Python, JavaScript, and regex engines to report every match, capture groups, and engine disagreements before you claim the pattern works.

Instructions

Run a regex against text in REAL engines and report every match.

Use this to check any regex before telling the user it works. For each engine you get all matches (global search) with [start:end) spans in Unicode code points, the numbered and named capture groups, and a flag when engines disagree.

pattern: the regex source, exactly as it would appear in code (no delimiters, no extra string escaping). subject: one text, or a list of texts; each list item is a separate case. flags: letters: i ignore case, m multiline, s dot matches newline, x verbose and a ASCII classes (Python only), u unicode, v unicodeSets and y sticky (JavaScript only). g is implied. engines: any of "python", "javascript" (or "js"), "regex". Default: every engine available on this machine; unavailable ones are reported, not silently skipped. timeout_s: hard limit (0.2-30). A run that exceeds it is killed and reported as a catastrophic-backtracking case. max_matches: cap per case (max 500). Limits: pattern 5000 chars, 100 cases, 200k characters of subject in total.

Input Schema

NameRequiredDescriptionDefault
flagsNo
enginesNo
patternYes
subjectYes
timeout_sNo
max_matchesNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

No annotations are supplied, so the description carries the full burden and does so: default is every available engine with unavailable ones reported rather than silently skipped, global search is implied, spans are in Unicode code points, disagreements between engines are flagged, and a timeout is killed and reported as a catastrophic-backtracking case. Hard limits (5000-char pattern, 100 cases, 200k subject chars, 500 match cap) are all disclosed.

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?

Purpose is front-loaded in the first two lines, then parameters are documented one per line in schema order, with limits consolidated at the end. Each line adds non-redundant information; nothing is padding.

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

Completeness5/5

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

An output schema exists so return values need only be sketched, and the description still names spans, capture groups, and disagreement flags. Combined with engine defaults, killing behavior, and size caps, an agent has everything needed to call this correctly on the first try.

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 description coverage is 0%, but the description compensates for all six parameters: pattern format (no delimiters, no extra escaping), subject accepting one text or a list treated as separate cases, per-letter flag semantics including engine-specific ones (a=Python, v/y=JavaScript), engine name aliases and default, timeout range 0.2-30, and max_matches ceiling.

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 first line states a specific verb and resource ('Run a regex against text in REAL engines') plus the output contract ('report every match'), which separates it from explain_regex (explanation) and convert_pattern (translation). The second sentence gives the operational intent, so an agent knows exactly what it gets back without opening the schema.

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?

'Use this to check any regex before telling the user it works' is an explicit when-to-use condition tied to a real workflow. It stops short of naming alternatives or stating when-not-to-use it (e.g. use explain_regex when the user wants an explanation rather than results), so it is strong but not fully routing.

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