Skip to main content
Glama

Test a regular expression

regex_test
Read-onlyIdempotent

Runs a JavaScript regular expression against text and returns every match with its position and capture groups, or the text after replacement. Use it to verify a regex actually works before relying on it.

Input Schema

NameRequiredDescriptionDefault
textYes
flagsNoOptional flags: i (ignore case), m (multiline), s (dotall), u (unicode), y (sticky). Global matching is always on.
patternYesRegex pattern without slashes, e.g. "(\\d{3})-(\\d{4})"
max_matchesNoDefault 100
replace_withNoOptional replacement string ($1, $<name> supported). If set, returns the replaced text too.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, closed-world), so the description's added value is the disclosure that this is JavaScript-flavored regex and what the return contains (match positions, capture groups, or post-replacement text). It does not mention behavior on an invalid pattern or truncation via max_matches, which is the main remaining gap.

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?

Two sentences with no filler; the core behavior and output shape come first and the usage cue follows. Every clause carries information an agent needs.

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?

With no output schema, the description correctly compensates by describing the return shape (matches with positions and capture groups, or replaced text). It could be more complete by noting invalid-pattern errors and the max_matches cap, but it covers what an agent needs to invoke it correctly.

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 80% (text is the only undocumented parameter), so the schema already carries the parameter burden. The description mentions capture groups and replacement output but adds no syntax or default details beyond what the schema provides, so the baseline 3 applies.

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 (runs) and resource (JavaScript regular expression against text) and enumerates the outputs (every match with position and capture groups, or the replaced text). This clearly separates it from the validate_* siblings, which check a fixed format rather than executing a user-supplied pattern.

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 it to verify a regex actually works before relying on it" gives a concrete usage context, which is more than most utility tools offer. It stops short of naming alternatives or stating when-not to use it (e.g., versus validate_email for a known format), so it is clear context without exclusions.

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