Skip to main content
Glama

Agent Data Hub

Regex tester: run a regular expression, get matches + groups

util_regex
Read-onlyIdempotent

Run a JavaScript regular expression against text and get every match with its position, numbered and named capture groups, plus an optional replace result. Use to extract emails/IDs/prices from text, or to check a regex before putting it in code. Accepts /pattern/flags or pattern + flags (g i m s u y d v). Up to 100k characters of text and 1000 matches returned. Sandboxed with a 250 ms limit: catastrophic-backtracking patterns return 400 (not charged) instead of hanging. Price: $0.001 per call (USDC on Base via x402); the first 10 calls per day are free.

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>",
      "text": "<text>"
    },
    "name": "util_regex"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesText to search (max 100,000 chars)
flagsNoFlags, e.g. gi (optional; default from /…/flags or none)
patternYesRegex, e.g. (?<user>[\w.]+)@(?<domain>[\w.-]+\.\w+) or /abc/i
replaceNoOptional replacement string ($1, $<name> allowed)
max_matchesNoMax matches to return, 1–1000 (default 100)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Goes well past the readOnly/idempotent/destructive annotations by disclosing hard limits (100k characters, 1000 matches), the sandbox with a 250 ms timeout, and that catastrophic backtracking returns 400 without being charged. The pricing model (USDC on Base via x402, first 10 calls/day free) is exactly the kind of cost/auth context an agent needs before invoking.

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?

A single dense paragraph but front-loaded with the core action and output shape, followed by use cases, then limits and pricing. Every sentence carries distinct, actionable information with no filler.

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?

There is no output schema, and the description compensates by describing the return shape (matches, positions, capture groups, replace result). Combined with error behavior and resource limits, an agent has everything needed to call it correctly.

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

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description adds value by listing the accepted flag characters (g i m s u y d v), the /pattern/flags shorthand, and the $1 / $<name> replacement syntax, none of which appear as enums in the schema. It does not clarify max_matches defaults or string typing beyond what the schema states.

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 ("Run a JavaScript regular expression against text") and enumerates the outputs: every match with position, numbered and named capture groups, optional replace result. This clearly separates it from sibling utilities like util_text_stats or util_diff.

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?

Gives concrete usage contexts: extracting emails/IDs/prices and checking a regex before putting it in code. It does not name an alternative sibling or state when not to use it, so it stops short of explicit routing.

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