Skip to main content
Glama

regex-check

Regex catastrophic-backtracking check, then test cases only if proven safe — Statically analyses an ECMAScript regular expression (up to 500 characters) for catastrophic backtracking (nested or overlapping quantifiers, ambiguous alternation in a loop, backreferences, lookarounds) for agents that write or accept regexes. Runs the caller's test subjects (up to 20, 1000 characters each) only when the pattern is proven polynomially bounded and the subject is short enough for t

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "pattern": "<pattern>"
    },
    "name": "regex-check"
  }
}

Input Schema

NameRequiredDescriptionDefault
casesNoSubjects to test; at most 10000 characters in total.
flagsNoFlags among dgimsuy (v is reported unsupported).
patternYesECMAScript regex source, without slashes.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description does real work: it enumerates the hazards detected (nested/overlapping quantifiers, ambiguous alternation in a loop, backreferences, lookarounds) and discloses the safety gate that suppresses execution. However the final clause is cut off mid-word ('short enough for t'), so the disclosure of when cases are skipped or what is reported instead is left incomplete, and nothing states side-effect or resource-cost profile.

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

Conciseness4/5

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

Front-loaded with the core verb and the safe-then-test ordering, and the hazard list is compact rather than padded. It loses a point because the second sentence is truncated mid-word, leaving a dangling clause that neither informs nor reads as intentional.

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

Completeness3/5

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

For a 3-parameter tool with a rich schema and no output schema, most of what an agent needs is present: input constraints, detection scope, and the execution gate. The truncated ending is a real gap, though, since the sentence was in the middle of defining a substantive condition on when test subjects are actually run.

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 coverage is 100%, so pattern, flags, and cases are already documented with formats and limits in the schema itself. The description largely restates the same caps (500 characters, 20 subjects, 1000 characters each) rather than adding new meaning about how expectMatch or unsupported flags are handled. Baseline 3 is appropriate.

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 verb and resource ('Statically analyses an ECMAScript regular expression') plus the exact defect class it hunts ('catastrophic backtracking') and the follow-on behavior ('Runs the caller's test subjects ... only when the pattern is proven polynomially bounded'). An agent knows precisely what this tool does and what it will not do.

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?

Audience and context are explicit ('for agents that write or accept regexes'), and the conditional sequencing is spelled out: the static check runs first, test cases execute only if the pattern is proven safe. No sibling alternative is named, and no explicit when-not-to-use is given, which keeps it below a 5.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources