regex-quality
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@regex-qualityCheck regex '^(a+)+$' for exponential backtracing"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
regex-quality
An MCP server that helps a calling LLM produce regexes that are concise, correct, and performant. It supplies the formal ground truth the model lacks: it generates adversarial input, measures time-blowup (NFA backtracking) and memory-blowup (RE2 DFA), checks correctness, and returns a structured verdict the model iterates against. The model composes; this server checks.
It is a modern Python port of XlogicX/8ball
(benchrexes.pl + nfagen.pl), keeping the behaviour and dropping the brittle
goto-driven Perl string-surgery where it helps.
For even more context to why this project exists, a blog form is here: https://xlogicx.micro.blog/2026/06/27/language-is-forgiving-regex-isnt.html
What it does
Evil/benign string generation — pump a regex to its catastrophic input (
gen_evil) and to a minimal matching baseline (gen_benign).NFA time metric — time evil vs benign in a killable subprocess, sweep increasing pump sizes, and classify growth
linear | polynomial | exponential.DFA memory metric — compile under
google-re2across amax_memsweep to find the memory cliff.Correctness — check intended positives match and negatives don't.
Diagnose + analyze — name the dangerous construct and the family of safe rewrites, and give a single accept/reject verdict. Never auto-rewrites.
Related MCP server: RegexForge
Setup
Requires Python 3.11+.
python3 -m venv .venv
.venv/bin/pip install -e .Run the MCP server (stdio transport):
.venv/bin/regex-quality-mcpRegister it with an MCP client, e.g. Claude Code:
claude mcp add regex-quality -- /abs/path/to/.venv/bin/regex-quality-mcpMCP tools
tool | returns |
|
|
|
|
|
|
|
|
|
|
| correctness + NFA verdict + DFA memory + named construct + safe-rewrite family + |
|
|
|
|
|
|
See docs/SUCCESS.md for how the calling model should drive the loop, and docs/ALGORITHM.md for the ported algorithm and its known limitations.
Rewrite, fix, and multi-engine tools
suggest_rewrites— mechanically generates candidate safe rewrites of the dangerous construct(s)analyzelocates (require_separator,factor_prefix,atomic_group,possessive) and returns only those that are verified: correctness on your test cases, non-super-linear growth on the engine, and language equivalence to the original. Equivalence is exact (DFA via Brzozowski derivatives) when both patterns are in the regular subset, else seeded differential fuzzing. A candidate issafe/bestonly if all three hold.fix_until_safe— drivessuggest_rewritesin a loop and returns a single guaranteed-safe equivalent (safe on every requested engine and equivalent to the input) or an honestsuccess:falsewith afailure_reasonand the closest candidate. Never fabricates a fix.analyze_matrix— runs the growth classification across engines (Pythonre/regex, RE2, Node/V8, Go, Java, PCRE2) and returns a per-engine matrix. The same pattern can be exponential on a backtracking engine yet linear on an automaton engine (RE2/Go). Missing engines are reported, never omitted.
The no-silent-success contract
This server exists because a tool that fails silently is worse than no tool. So:
Never "safe"/"accepted" for an unverified condition. A rewrite is reported safe only when correctness, growth, and equivalence are all verified.
Unavailable engines are surfaced, not skipped. If an engine isn't installed, the output carries
available:false+skipped_reason; the overall verdict becomesunverified(neveraccepted). We never silently substitute engines.Timeouts ≠ agreement. If a fuzz comparison can't complete (e.g. a catastrophic original), equivalence is reported as not established, never as equivalent.
Determinism. All fuzzing takes a
seed(default 0) and is reproducible.Self-DoS-proof. Every candidate match — including fuzz batches — runs under the killable subprocess + hard-timeout isolation.
equivalence_mode: exact (regular subset only; refuses irregular honestly),
fuzz (differential), or auto (exact when both regular, else fuzz). Exact
results carry exact:true (a proof); fuzz results carry exact:false (evidence —
can disprove, can only support).
Definition of done
analyze accepts a regex only if it (a) matches all intended positives and rejects
all intended negatives on the target engine, and (b) shows no super-linear NFA
growth on that engine, and (c) compiles within a configurable RE2 memory bound.
Deterministic and repeatable.
from regex_quality.analyze import analyze
analyze("^(t+k?)+z$", ["tz","tktz","ttktttz"], ["z","tkkz","tt"]).accepted # False (EXPONENTIAL)
analyze("^t+(?:kt+)*k?z$", ["tz","tktz","ttktttz"], ["z","tkkz","tt"]).accepted # True (LINEAR, equivalent)Engine is first-class
Vulnerability is a property of regex AND engine. The NFA metric defaults to
Python re; modern Perl and RE2 optimize many catastrophes away, while Python re
and Node/V8 don't. Check the engine you actually deploy on.
Project layout
src/regex_quality/ the package
expand, lastlexeme, generate, tokenizer string generation + AST parser
worker, _match_worker.{py,js,go}, engines killable subprocess + engine registry
nfa_bench, dfa_bench, diagnose, correctness, analyze the core metrics/verdict
derivatives, fuzz, equivalence exact (DFA) + differential equivalence
rewrites, suggest, matrix suggest_rewrites / fix_until_safe / analyze_matrix
server FastMCP server (9 tools)
tests/ maintained pytest suite (incl. the acceptance oracles)
parity/ verbatim-Perl oracle + parity harness + REPORT.md
reference/ vendored benchrexes.pl / nfagen.pl
docs/ ALGORITHM.md, SUCCESS.mdEngines
The NFA growth metric runs on any installed engine; analyze_matrix reports the
whole registry. Detected at runtime (never assumed):
engine | family | status |
| backtracking | always available |
| backtracking | available (pinned dep) |
| automaton (linear) | always available |
| backtracking | available if |
| automaton (linear) | wired; needs the |
| backtracking | detection only (worker not wired — no stdlib JSON) |
| backtracking | detection only (no binding/CLI wired) |
Tests & parity
.venv/bin/python -m pytest # full suite (81 tests)The parity harness diffs the Python port against the verbatim Perl
string-generation subs over the 8ball corpora (~92% exact match; the rest are the
documented newline-in-class corner). It needs perl plus Try::Tiny,
IO::CaptureOutput, Time::Out and PERL5LIB set; the pytest skips cleanly when
they're absent.
PERL5LIB="$HOME/perl5/lib/perl5" python parity/run_parity.py # regenerate REPORT.mdProvenance & license
The algorithmic core of this project is XlogicX/8ball
— the original, hand-written Perl ReDoS benchmarking engine (evil/benign string
generation and the NFA-time / DFA-memory metrics). That hand-coded engine is the
seed and the source of truth this work is verified against. The Python port and
modernization, plus the equivalence/rewrite/multi-engine tooling layered on top,
were substantially developed with Claude Code
(AI-assisted), directed against the 8ball behaviour.
Licensed under the MIT License.
Available Tools
9 toolsanalyzeA
Composite verdict: accept pattern only if it (a) passes all test cases, (b) shows no super-linear NFA growth on the engine, and (c) compiles within the RE2 memory bound. On rejection, names the dangerous construct and the family of safe rewrites to try. Does not auto-rewrite.
| Name | Required | Description | Default |
|---|---|---|---|
| engine | No | python | |
| qlimit | No | ||
| pattern | Yes | ||
| negatives | No | ||
| positives | No | ||
| timeout_ms | No | ||
| mem_bound_bytes | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full transparency burden. It discloses meaningful behavioral details: the three criteria for acceptance, rejection output (names dangerous construct and safe rewrite families), and a limitation (does not auto-rewrite). It omits potential side effects like whether user-supplied test cases are executed, but the core behavior is well covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise and well-structured: three sentences, front-loaded with the tool's purpose, and each sentence adds critical information (accept criteria, rejection behavior, non-rewrite boundary). No filler or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite having an output schema, this is a 7-parameter tool with no schema descriptions and no annotations. The description provides a strong high-level overview, but it is insufficiently complete for an agent to correctly configure parameters like qlimit, timeout_ms, and positives/negatives. The complexity demands more parameter-level detail and usage guidance than is provided.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 0%, so the description must compensate. It references 'pattern' and hints at test cases and 'RE2 memory bound,' which map to positives/negatives and mem_bound_bytes, but it fails to explain engine, qlimit, timeout_ms, or the structure of positives/negatives. This leaves several parameters under-specified for correct invocation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with 'Composite verdict' and clearly specifies the exact accept criteria (passes all test cases, no super-linear NFA growth, RE2 memory bound). It also distinguishes itself from siblings by framing itself as an overarching analyzer and explicitly noting it does not auto-rewrite, which sets it apart from mutation-oriented tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context: this tool returns a composite accept/reject verdict and is not for rewriting. It implies when to use it (when a holistic safety decision is needed) and when not (when auto-rewrite is desired), though it does not explicitly name sibling alternatives or provide explicit exclusions beyond 'Does not auto-rewrite.'
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
analyze_matrixA
Classify NFA growth for one pattern across MULTIPLE regex engines and return a per-engine matrix. Use this to decide whether a pattern is safe on the engine you actually deploy on -- the same regex can be exponential on a backtracking engine (Python re/regex, Node/V8, PCRE2, Java) yet linear on an automaton engine (RE2, Go).
Every requested engine appears in per_engine: installed ones with a measured
growth verdict + curve, missing ones with available=false and a
skipped_reason (never silently omitted). DFA/memory analysis runs once
(engine-independent); correctness runs once on a reference engine.
overall_accepted is true only if the pattern is safe on every requested
engine that is available AND none were unavailable; otherwise the result is
honestly unverified. Default engines covers the whole registry
(python, regex, re2, node, go, java, pcre2).
| Name | Required | Description | Default |
|---|---|---|---|
| engines | No | ||
| pattern | Yes | ||
| negatives | No | ||
| positives | No | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It reveals that missing engines appear with available=false and a skipped_reason (never silently omitted), that overall_accepted is true only under strict conditions (otherwise honestly 'unverified'), and that DFA/memory and correctness runs are deduplicated. This is rich, non-obvious behavioral detail.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The first sentence is a clear, front-loaded summary. The following paragraphs are logically organized into usage context, per-engine behavior, and overall acceptance logic. Every sentence adds value and there is no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity and the presence of an output schema, the description explains engine defaults, availability handling, and overall_accepted logic well. However, key input parameters (positives, negatives, timeout_ms) are left undefined, leaving a modest completeness gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 0% description coverage, so the description must compensate. It clarifies the engines parameter's null/default behavior (whole registry) and explains result semantics. However, it does not define the positives, negatives, or timeout_ms parameters, leaving critical input semantics ambiguous. Compensation is only partial.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb ('Classify NFA growth') and clearly scopes the tool to one pattern across multiple regex engines, returning a per-engine matrix. This distinguishes it from sibling tools like gen_benign/gen_evil and analyze, and the use case ('decide whether a pattern is safe on the engine you actually deploy on') reinforces its purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly states when to use the tool: 'Use this to decide whether a pattern is safe on the engine you actually deploy on'. It contrasts backtracking vs automaton engines, giving clear context. It does not explicitly name alternative sibling tools, so it stops short of a 5, but the usage context is unambiguous.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
fix_until_safeA
Drive suggest_rewrites in a loop and return a GUARANTEED-safe equivalent
or an honest failure. Use this when you want the server to do the iteration
for you and hand back a single fixed pattern you can trust.
success=true requires the fixed pattern to be verified non-super-linear on
EVERY requested engine (default ["python"]) AND provably/empirically
equivalent to the original input. If no such pattern exists, or a requested
engine isn't installed, returns success=false with failure_reason and the
closest candidate -- never a fabricated fix. Deterministic for a given seed.
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | ||
| fuzz_n | No | ||
| engines | No | ||
| pattern | Yes | ||
| negatives | No | ||
| positives | No | ||
| timeout_ms | No | ||
| max_iterations | No | ||
| equivalence_mode | No | auto |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses important behavioral traits: success requires verification on every requested engine, returns are never fabricated, failures include a failure_reason and closest candidate, and behavior is deterministic for a seed. This goes well beyond a basic summary.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured: a clear opening sentence, a usage directive, and a compact specification of success/failure conditions. Every sentence adds value and no filler is present.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex tool with 9 parameters and an output schema, the description covers the core algorithmic behavior, safety guarantees, failure mode, and determinism. It does not explain every parameter or timeout/loop-bound details, but the output schema and parameter names carry some of that weight, making it mostly complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It adds meaning for engines (default ['python']) and seed (determinism), but leaves several parameters — fuzz_n, max_iterations, positives, negatives, equivalence_mode — semantically unexplained. Additionally, the description's engines default contradicts the schema default of null, creating a small inconsistency.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb and resource ('Drive suggest_rewrites in a loop') and clearly states the outcome: a guaranteed-safe equivalent or an honest failure. It distinguishes itself from the sibling tool suggest_rewrites by framing this tool as the iterative, server-driven wrapper that returns a final trusted result.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It explicitly says 'Use this when you want the server to do the iteration for you and hand back a single fixed pattern you can trust,' giving clear when-to-use guidance. It also defines success criteria and failure behavior, making the choice between this and lower-level siblings like suggest_rewrites straightforward.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
gen_benignC
Generate a minimal string that pattern matches quickly (the baseline).
| Name | Required | Description | Default |
|---|---|---|---|
| engine | No | python | |
| pattern | Yes | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden for behavioral disclosure, but it only mentions that the generated string is minimal and matches quickly. It does not cover timeout behavior, engine defaults, failure modes, or how 'minimal' is defined, leaving significant transparency gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no fluff, effectively conveying the core action. However, it is under-specified for a tool with three parameters, though that lack is captured in other dimensions.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
While an output schema exists, the description omits usage context, parameter details, and behavioral notes. The tool is relatively simple, but the combination of no annotations, 0% schema coverage, and minimal description leaves the agent without enough information to select and invoke it confidently.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description only references 'pattern' implicitly ('*pattern* matches quickly'). The 'engine' and 'timeout_ms' parameters are not mentioned at all, providing insufficient semantic context for parameter usage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool generates a minimal string that matches a pattern quickly, with 'the baseline' hinting at its role as the benign counterpart to gen_evil. The verb 'generate' and resource 'string' are specific, though sibling differentiation relies on implication rather than explicit contrast.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like gen_evil or redos_bench. The term 'baseline' implies a comparison but does not explicitly state usage scenarios, prerequisites, or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
gen_evilB
Generate an adversarial string that pumps pattern and then fails to match, forcing maximal backtracking. Returns the evil string and whether it fails to match (a timeout counts as failing -- it's the vulnerability).
| Name | Required | Description | Default |
|---|---|---|---|
| engine | No | python | |
| qlimit | No | ||
| pattern | Yes | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of disclosure. It transparently states the return value (the evil string and whether it fails to match) and importantly clarifies that a timeout counts as failing, which is a key behavior for understanding the vulnerability.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is exactly two sentences with no filler. It front-loads the core action, then adds the key return-value detail and timeout semantics, making every word earn its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has 4 parameters, no annotations, and an output schema whose content is unknown. While the description explains the main generation behavior and return status, it omits details about the other three parameters and does not address error cases or engine-specific behavior, leaving the description incomplete for reliable invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 4 parameters with 0% schema description coverage. The description only mentions the pattern placeholder and does not explain the meaning or usage of engine, qlimit, or timeout_ms. With no other source of parameter information, this is a significant gap.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description begins with a specific verb ('Generate') and identifies the resource ('adversarial string') and the mechanism ('pumps *pattern* and then fails to match, forcing maximal backtracking'). This clearly distinguishes the tool from its sibling gen_benign, which presumably generates benign strings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description does not state when to use this tool versus alternatives like gen_benign or redos_bench. It implies use for testing ReDoS vulnerabilities by generating backtracking-inducing strings, but provides no explicit context, prerequisites, or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
re2_memoryB
Sweep RE2 max_mem to find the DFA compile-memory cliff: the largest cap at which compilation fails and the smallest at which it succeeds.
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must fully disclose behavior, but it only vaguely says 'sweep' without explaining that this likely involves many compilation attempts, potential performance impacts, or side effects. It also doesn't state what happens on failure or how results are returned.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence that immediately states the action and purpose. It contains no filler, is well-front-loaded with the verb 'Sweep', and efficiently delivers the key information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
While an output schema exists (blunting the need to describe return values), the tool lacks guidance on when to use it, what the pattern parameter means, and what the 'sweep' entails operationally. For a tool with one parameter and no annotations, this is insufficiently context-rich.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has only one parameter, 'pattern', with 0% description coverage. The description never mentions this parameter or explains that 'pattern' is the regex to test. This is a significant gap since the parameter's role is left to inference.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's specific purpose: sweeping RE2 max_mem to find the compile-memory cliff. It names the resource (RE2 max_mem), the action (sweep), and the exact outcome (largest failing cap, smallest succeeding cap), distinguishing it from siblings like analyze or suggest_rewrites.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no explicit when-to-use guidance, alternatives, or prerequisites. It implies use when you need to understand memory limits for a specific regex pattern, but it never states this directly or contrasts with sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
redos_benchA
Time the evil vs benign string AND sweep increasing pump sizes to classify growth as linear / polynomial / exponential. The verdict names the engine.
| Name | Required | Description | Default |
|---|---|---|---|
| engine | No | python | |
| qlimit | No | ||
| pattern | Yes | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full responsibility for behavioral disclosure. It reveals that the tool times both evil and benign strings, sweeps pump sizes, and produces a verdict naming the engine. However, it does not disclose potential computational cost, timeout behavior, or side effects, leaving significant gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loaded, with two sentences covering the core action, goal, and outcome. It avoids redundancy but uses somewhat cryptic phrasing ('evil vs benign string') that could be clearer without adding length.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Output schema exists, so return values are covered, but the description lacks context about prerequisites (e.g., valid regex pattern), how the tool interacts with sibling tools (gen_benign/gen_evil), and what the verdict actually implies. No annotations exist, so the description is the only context and it is incomplete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must explain parameters. It never mentions 'pattern', 'engine', 'qlimit', or 'timeout_ms' by name, and the reference to 'pump sizes' does not map clearly to any parameter. This leaves the agent guessing about how to set parameters correctly.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses specific verbs ('time', 'sweep', 'classify') and clearly identifies the resource (evil vs benign strings) and the goal (classify growth as linear/polynomial/exponential). It distinguishes itself from sibling tools (gen_benign, gen_evil, analyze) by being the benchmarking/classification tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for classifying ReDoS growth patterns but does not explicitly state when to use this tool versus alternatives like analyze or re2_memory. No excluded scenarios or cross-references to sibling tools are provided, leaving usage context vague.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
suggest_rewritesA
Mechanically generate safe-rewrite CANDIDATES for a ReDoS-prone pattern and
return only the ones that are VERIFIED. Use this when analyze/redos_bench
flags a pattern as super-linear and you want a concrete, drop-in replacement
rather than just the name of a technique.
Each candidate is independently checked: correctness on your positives/
negatives, non-super-linear growth on engine, AND language equivalence to
the original (exact DFA comparison when both are regular, else seeded
differential fuzzing). A candidate is marked safe/chosen as best ONLY if
all three hold -- never an unverified guess. best is null when nothing
verifies. Deterministic for a given seed. Note: atomic-group/possessive
candidates need a modern engine (Python re>=3.11, PCRE2, Java); RE2/Go can't
parse them, which the candidate notes call out.
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | ||
| engine | No | python | |
| fuzz_n | No | ||
| pattern | Yes | ||
| negatives | No | ||
| positives | No | ||
| timeout_ms | No | ||
| equivalence_mode | No | auto |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description fully bears the transparency burden. It details the three independent verification checks (correctness on positives/negatives, non-super-linear growth, language equivalence), explains that `safe`/`best` are only assigned when all checks pass, states `best` is null if nothing verifies, mentions determinism for a given seed, and calls out engine compatibility limitations. This is comprehensive behavioral disclosure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is dense but well-organized: core purpose, usage context, verification process, and caveats are presented in a logical progression. Every sentence adds information, though it is somewhat lengthy. It earns a high score for structure without being excessively verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (8 parameters, no annotations) and that an output schema exists (which covers return structure), the description is complete. It covers when to use, how verification works, failure behavior (`best` null), determinism, and engine limitations. This is sufficient for an agent to select and invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%. The description adds meaning for key parameters (`seed`, `engine`, `positives`/`negatives`) by explaining their roles in determinism, engine-specific parsing, and correctness checks. However, `fuzz_n`, `timeout_ms`, and `equivalence_mode` are not mentioned, leaving gaps in the parameter semantics. It partially compensates but not fully for all 8 parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with 'Mechanically generate safe-rewrite CANDIDATES for a ReDoS-prone pattern and return only the ones that are VERIFIED,' which uses a specific verb and resource. It clearly distinguishes from siblings by referencing `analyze`/`redos_bench` flags and offering concrete replacements rather than technique names.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly states when to use: 'Use this when `analyze`/`redos_bench` flags a pattern as super-linear and you want a concrete, drop-in replacement rather than just the name of a technique.' It also provides alternative-aware guidance by contrasting with 'name of a technique' and highlights engine caveats for atomic-group candidates.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
test_casesA
Check pattern matches all positives and rejects all negatives (each in a killable subprocess). Returns pass plus any false positives/negatives.
| Name | Required | Description | Default |
|---|---|---|---|
| engine | No | python | |
| pattern | Yes | ||
| negatives | Yes | ||
| positives | Yes | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Without annotations, the description carries the transparency burden. It discloses the use of a 'killable subprocess' (important for safety against ReDoS hangs) and states the return contents (pass plus false positives/negatives). This goes beyond the schema and provides useful behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences, front-loaded with the action verb 'Check', and contains no filler or irrelevant detail. Every word contributes to understanding the tool's function and behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the core purpose, key parameters, return value, and the important safety behavior (subprocess/killable). Given that an output schema exists and optional parameters have defaults, the description is adequate, though it could mention the `engine` and `timeout_ms` parameters for completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description explains the semantic roles of the three required parameters: `pattern`, `positives`, and `negatives`. However, it does not explain the optional `engine` or `timeout_ms` parameters. With 0% schema coverage, the description only partially compensates for the missing parameter documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function with a specific verb ('Check'), the resource ('*pattern*'), and the expected outcome ('matches all positives and rejects all negatives'). This distinguishes it from sibling tools like `gen_benign` or `analyze`, which have different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the tool (to validate a regex against positive/negative examples) but provides no explicit guidance on when to prefer it over alternatives or what prerequisites exist. It does not mention exclusions or alternatives, so it earns a mid-range score.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Most tools serve distinct purposes: generation, benchmarking, memory, testing, analysis, rewriting, and fixing. However, analyze, analyze_matrix, and redos_bench all involve growth classification and could be confused by an agent; detailed descriptions mitigate but don't eliminate the overlap.
Naming mixes verb-led patterns (gen_benign, suggest_rewrites, analyze_matrix) with noun-phrases (redos_bench, re2_memory, test_cases) and a bare verb (analyze). All names are snake_case and descriptive, but the pattern is not uniform.
9 tools cover the full workflow of regex safety: generation, benchmarking, memory analysis, correctness testing, composite analysis, rewrite suggestion, and automated fixing. Each tool earns its place with a distinct function.
The server provides end-to-end coverage from generating attack strings to verifying safe rewrites, including multi-engine classification. No obvious dead ends; fix_until_safe offers a guaranteed outcome or honest failure.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Detects catastrophic-backtracking (ReDoS) regex risk via AST parsing, with JS-safe rewrites.
Deterministic regex synthesis from labeled examples. Zero LLM, proof matrix, backtracking audit.
Exact text tools for AI agents: unified diff, patch apply, regex testing, grapheme counting.
Deterministic validation for AI-generated artifacts: JSON Schema, OpenAPI response, SQL syntax.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables LLMs to systematically develop and validate regex patterns by defining test cases with expected matches, testing patterns against them, and iteratively refining until all requirements are satisfied.46MIT
- FlicenseNot gradedqualityCmaintenanceRegexForge gives AI agents a reliable way to get a regex without asking an LLM to hallucinate one. Pass in labeled examples (strings that should match, strings that shouldn't) plus an optional description; get back the regex, a proof matrix showing it handles every example, and a backtracking-risk audit flagging catastrophic-backtracking patterns. Pure symbolic synthesis over a template bank with
- AlicenseAqualityAmaintenanceEnables an LLM to author, validate, and test Wirefilter WAF and Smart Firewall rules using live schema and real CVE exploit templates.71MIT
- AlicenseNot gradedqualityAmaintenanceProvides a tool to extract and validate regex patterns from text content, including flags, positions, and ReDoS risk assessment. Enables AI agents to identify potentially dangerous regular expressions in code or files without needing filesystem access.2MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/XlogicX/ReDetox'
If you have feedback or need assistance with the MCP directory API, please join our Discord server