Skip to main content
Glama
regexlab-mcp
by 0xmortuex

check_backtracking

Detect catastrophic regex backtracking (ReDoS) by static analysis and timing adversarial input in a killed child process, reporting exponential patterns with a slow example input.

Instructions

Check a regex for catastrophic backtracking (ReDoS) by analysing AND timing it.

Two stages. Static: finds nested quantifiers like (a+)+, alternation with overlapping branches inside a loop, adjacent overlapping repeats like .., and unanchored leading repeats. Empirical: builds adversarial input for the worst suspects and times it in the real engine in a child process that is KILLED at the time limit. A pattern that hits the limit is reported as exponential, with an example slow input. Static suspicions the probe cannot reproduce are reported as unconfirmed; "no finding" is evidence, not proof.

engine: "python" (default), "javascript", "regex", or "all" for every available engine (V8 and Python's re have different optimisations, so results can differ). timeout_s: time budget per probe run, 0.2-30 (default 3).

Input Schema

NameRequiredDescriptionDefault
flagsNo
engineNopython
patternYes
timeout_sNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations at all, the description carries the full burden and does so well: it discloses that probing happens in a child process KILLED at the time limit, that static suspicions may be reported as unconfirmed, that "no finding" is evidence not proof, and that V8 vs Python optimisations can produce different answers. That is exactly the kind of execution-model and confidence context an agent cannot infer from the schema.

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?

Front-loaded with the core claim, then a compact "Two stages. Static: … Empirical: …" structure, then per-parameter notes. Every sentence adds information; nothing is padded or repeated from the schema.

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?

An output schema exists, so return-value detail is not needed, and the description covers execution model, confidence semantics, engine differences and the timeout knob. The remaining gap is the undocumented flags parameter and the fact that timeout_s is per-probe while engine="all" multiplies total runtime, which is left implicit.

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

Parameters3/5

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 supplies real meaning for engine (listing "python", "javascript", "regex", "all" plus why results differ) and timeout_s (meaning, range 0.2-30, default 3), and pattern is self-evident, but flags receives no explanation at all despite being a free string parameter.

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?

"Check a regex for catastrophic backtracking (ReDoS) by analysing AND timing it" states a specific verb, a specific target condition, and the two mechanisms used. It is immediately distinguishable from siblings like test_regex or explain_regex, which serve different intents.

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

Usage Guidelines3/5

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

The description makes clear what the tool is for (ReDoS detection) and how to interpret results (confirmed vs unconfirmed), which implies when to reach for it. However, it never explicitly says when to use this instead of test_regex or compare_engines, nor does it state preconditions such as needing a candidate pattern before deployment.

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