Skip to main content
Glama

SimplyUtils

Test a regular expression

test_regex
Read-only

Run a JavaScript (ECMAScript) regular expression against text. Returns the match count and, for each match, the matched text, its 0-based index, numbered capture groups and named groups. Returns 'No matches.' when nothing matches. All matches are listed (the g flag is added automatically), up to 200. Invalid patterns or flags return an error explaining why; patterns that run longer than 0.5 seconds are stopped with an error. Text up to 100 KB.

Input Schema

NameRequiredDescriptionDefault
textYesThe text to search
flagsNoAny of d, g, i, m, s, u, v, y; for example gi for case-insensitiveg
patternYesThe pattern without surrounding slashes, for example (\d+)-(?<unit>[a-z]+)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / flags / description
      Previous value: -"JavaScript flags such as gi"New value: +"Any of d, g, i, m, s, u, v, y; for example gi for case-insensitive"
    • changedInput schema / properties / pattern / description
      Previous value: -"Pattern without slashes"New value: +"The pattern without surrounding slashes, for example (\\d+)-(?<unit>[a-z]+)"
    • addedInput schema / properties / text / description
      Added value: +"The text to search"
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Goes well beyond the readOnly/non-destructive annotations: it discloses the return shape (match count, matched text, index, numbered and named groups), the literal 'No matches.' string, the automatic g flag, a 200-match cap, a 0.5s timeout, error behavior for invalid patterns, and a 100 KB input limit. An agent knows exactly what to expect on success and failure.

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 sentences, front-loaded with purpose, followed by return shape and then operational limits. Every sentence carries information an agent needs; 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?

With no output schema, the description fully compensates by describing return values and the no-match sentinel, plus error and size/time limits. Nothing essential to correct invocation is missing.

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 description coverage is 100%, so the baseline is 3. The description adds real meaning beyond the schema by noting that the g flag is added automatically (which affects how the 'flags' parameter behaves) and implicitly clarifies that patterns should not include surrounding slashes, consistent with the pattern field description.

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 (ECMAScript) regular expression against text.' No sibling tool covers regex, so the name plus description makes selection unambiguous.

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?

The description establishes clear context for when this applies (testing an ECMAScript pattern against text) and implicitly excludes non-JS regex dialects. There are no sibling alternatives to route away from, so explicit when-not guidance isn't required, but none is offered.

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.