Skip to main content
Glama

Can this regex be made to hang?

check_redos
Read-onlyIdempotent

Detect catastrophic backtracking (ReDoS) in regex patterns to find vulnerable parts before running on untrusted input. Times execution across JavaScript, Python, PCRE2, and RE2 engines.

Instructions

Checks a regex for catastrophic backtracking (ReDoS): safe or vulnerable, exponential or polynomial, the part of the pattern to blame, an attack string, and how long each real engine (JavaScript, Python, PCRE2, RE2) takes on it. Use before a pattern runs on untrusted input.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flagsNo
verifyNotime the attack on the engines (default true)
patternYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, so the safety profile is covered. The description goes beyond that by disclosing the shape of the analysis (verdict, complexity class, blamed subpattern, attack string) and that it reports timing across four named real engines, which a caller planning untrusted-input gating needs to know.

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?

One dense clause enumerating the analysis outputs followed by a single usage sentence; the verdict and use case are front-loaded and no sentence is filler.

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 structure needn't be described, and annotations cover the safety profile. The remaining gap is the undocumented 'flags' parameter, which neither the schema nor the description explains; otherwise the definition is complete for calling this tool.

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 only 33%: only 'verify' is documented, and the description itself only indirectly touches it via 'how long each real engine... takes'. The 'flags' parameter has no explanation in either the schema or the description, so the description does not compensate for the coverage gap. Baseline 3 for a low-coverage, 3-param tool.

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?

States a specific analysis verb+resource ('checks a regex for catastrophic backtracking') and enumerates exactly what the result contains: verdict, exponential vs polynomial, culprit subpattern, attack string, and per-engine timings. This is clearly distinct from the sibling test_regex, which would test matching behavior rather than ReDoS vulnerability.

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 before a pattern runs on untrusted input' gives a clear triggering context. It stops short of naming an alternative or stating when-not-to-use (e.g. trusted static patterns), so it falls just short of 5.

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

Deploy Server

Other Tools