Skip to main content
Glama

Regex test

regex_test
Read-onlyIdempotent

Test a JavaScript regular expression against text to return matches, indexes, capture groups, and an optional replace preview, with a timeout guard against catastrophic backtracking.

Instructions

Run a JavaScript regular expression against text: every match with its index, length, numbered and named capture groups, plus an optional replace preview ($1, $, $&, $`, $', $$). Flags g i m s u y (and d, v). Runs in an isolated worker with a timeout (default 1.5 s) so catastrophic backtracking is reported instead of hanging. Lists up to 5000 matches. Web version: https://s3eidat.github.io/regex-playground/

Input Schema

NameRequiredDescriptionDefault
textYesThe text to search.
flagsNoRegex flags, default "g".g
limitNoMax matches to include in the result (count is still total). Default 500.
patternYesThe regex source, without slashes, e.g. "(\\d+)-(?<w>[a-z]+)".
replaceNoReplacement string for a replace preview (JavaScript String.replace syntax).
timeoutMsNoKill the regex after this many ms. Default 1500.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations: execution happens in an isolated worker, catastrophic backtracking is caught and reported rather than hanging, there is a default 1.5 s timeout, and matches are capped at 5000. These are exactly the traits an agent needs to predict failure modes.

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?

Four dense sentences, each carrying distinct information: what it returns, replacement syntax, flag/timeout behavior, and match cap. Capability is front-loaded and nothing repeats structured fields verbatim.

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?

No output schema exists, yet the description fully describes the return payload (matches with index, length, numbered and named capture groups, replace preview). Combined with the timeout and match-cap disclosures, an agent has everything needed to call it and interpret the result.

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 spelling out the accepted flag set (g i m s u y, plus d and v) and the replacement token syntax ($1, $<name>, $&, $`, $', $$), which the schema only alludes to as 'JavaScript String.replace syntax'. The 'up to 5000 matches' phrasing is slightly loose against the schema's default limit of 500.

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?

Names the specific verb and resource ('Run a JavaScript regular expression against text') and immediately enumerates what is returned — matches, index, length, capture groups, optional replace preview. An agent can distinguish this from text_diff, hash_compute, or json_schema_validate without opening the schema.

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?

Implies the use case (testing a regex and previewing replacements) but gives no explicit when-to-use vs alternatives, no prerequisites, and no exclusions. The trailing web-version URL is not usage guidance.

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

Deploy Server

Other Tools