Skip to main content
Glama

Generate a regular expression that passes your examples

regex_generate
Read-only

A regular expression from a description, with examples that must match and examples that must not. The pattern is returned only when every example passes when tested in the service (one retry with the failures). Patterns with nested quantifiers are refused to avoid catastrophic backtracking. Examples are up to 10 strings of 300 characters each. Price: $0.002 per successful call, paid with x402 (USDC on Base, Solana and 10 more networks); failed calls are not charged.

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": {
      "description": "<description>",
      "matches": "<matches>"
    },
    "name": "regex_generate"
  }
}

Input Schema

NameRequiredDescriptionDefault
matchesYesStrings the pattern must match (1-10 items, each max 300 characters)
nonMatchesNoStrings the pattern must not match (0-10 items, each max 300 characters)
descriptionYesWhat the pattern should match, in plain words (max 500 characters)

Output Schema

NameRequiredDescriptionDefault
noteNo
flagsNo
testsNo
patternNo
checkedAtNo
explanationNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedOutput schema / properties / checkedAt
      Added value: +{}
    • addedOutput schema / properties / explanation
      Added value: +{}
    • addedOutput schema / properties / flags
      Added value: +{}
    • addedOutput schema / properties / note
      Added value: +{}
    • addedOutput schema / properties / pattern
      Added value: +{}
    • addedOutput schema / properties / tests
      Added value: +{}
  2. Added

TDQS

A4/5.0
Behavior5/5

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

Beyond the readOnlyHint/openWorldHint annotations, the description discloses the verification contract (pattern returned only if every example passes, one retry against failures), a safety policy (nested quantifiers refused to avoid catastrophic backtracking), input ceilings, and the full cost model. It even clarifies that failed calls are not charged, which an agent needs before retrying.

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?

One dense paragraph with the input contract first, constraints and pricing after — front-loaded and free of filler. The opening noun fragment slightly weakens the lead, but every sentence carries information.

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?

Since an output schema exists, return shape need not be described, and the remaining gaps an agent would care about — validation behavior, retry semantics, refusals, limits, and pricing — are all covered. Nothing required to call this correctly is missing.

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 already 100%, and the description's only parameter detail (up to 10 strings of 300 characters) restates what the schema already says. It adds no semantics the schema lacks, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific artifact (a regular expression) and its inputs (matching and non-matching examples), which distinguishes it clearly from generic generators like sql_generate. It stops short of an explicit verb phrase such as 'generate a pattern', opening with a noun fragment instead.

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?

Usage is implied rather than stated: the agent can infer this is for turning examples into a pattern, and the refusal of nested quantifiers sketches a boundary. There is no explicit when-to-use or when-not guidance, and no reference to any alternative approach for the same goal.

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