Skip to main content
Glama

Linear-Time O(n) ReDoS-Safe Regular Expression Synthesizer & Tester

synthesize_safe_regex
Read-onlyIdempotent

Synthesizes linear-time O(n) regular expressions free of catastrophic backtracking (ReDoS) and validates them against positive and negative test strings. Use when generating and verifying a regular expression pattern for input validation or lexical parsing; for repairing broken JSON syntax directly without writing custom regexes, use heal_malformed_json instead. Stateless read-only edge call (max 32 KB, 60 RPM): accepts 'description' ('flavor' defaults to 'ecmascript_js'), supports '?demo=true' or L402 (15 sats), and returns HTTP 400 if invalid.

Input Schema

NameRequiredDescriptionDefault
flavorNoTarget regular expression engine syntax; defaults to 'ecmascript_js' when omitted.
descriptionYesNatural-language specification of the text pattern to match (e.g. 'RFC 5322 email addresses excluding plus-aliases').

Output Schema

NameRequiredDescriptionDefault
patternYesSynthesized regular expression pattern string (without slash delimiters).
redos_safeYesTrue when static star-height analysis confirms zero exponential backtracking.
test_resultsYesPass/fail verification results across positive and negative test cases.
time_complexityYesWorst-case matching complexity ('O(n)').

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, so the safety profile is covered. The description goes beyond them with operational detail: stateless, 32 KB max payload, 60 RPM, demo=true or L402 payment of 15 sats, and HTTP 400 on invalid input — exactly the auth/limit/error context annotations cannot express. Slightly dense but substantive.

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?

Purpose and the sibling alternative are front-loaded in the first two clauses. The trailing operational sentence packs rate limits, payment, and error codes into one parenthetical chain, which is efficient but slightly overloaded for a single sentence.

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 no explanation; the description instead covers the limits, payment/auth path, and failure mode an agent needs before calling. For a two-parameter tool this is complete.

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% and both properties carry descriptions and an enum, so the schema does the heavy lifting. The description only restates that 'description' is accepted and that 'flavor' defaults to 'ecmascript_js', which the schema already says — baseline 3.

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 ('Synthesizes linear-time O(n) regular expressions') plus a second action ('validates them against positive and negative test strings'). The property claimed (ReDoS-free, O(n)) is the discriminating trait versus siblings, and it names heal_malformed_json as the alternative.

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

Usage Guidelines5/5

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

Explicit use case is given ('generating and verifying a regular expression pattern for input validation or lexical parsing') along with an exclusion and the tool to use instead ('for repairing broken JSON syntax directly... use heal_malformed_json'). Nothing is left to inference about when to pick this tool.

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.