Skip to main content
Glama

Test a JavaScript regular expression

test_regex
Read-onlyIdempotent

Run a JavaScript regular expression against a sample and return every match, capture group, a short explanation, and an optional replacement.

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": "test_regex"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesSample to search.
flagsNo
patternYesJavaScript regular expression body, without slashes.
replacementNoWhen set, the sample is replaced and returned.

Output Schema

NameRequiredDescriptionDefault
matchesYes
truncatedYes
explanationYes
replacementYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / additionalProperties
      Added value: +false
  2. First observed

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and openWorldHint=false, so the safety profile is covered. The description adds that it returns every match plus capture groups and a human-readable explanation, and that replacement only happens when the parameter is set — useful context beyond annotations. It says nothing about invalid-pattern behavior or limits, so a 3 is fair.

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 well-formed sentence, front-loaded with the action and followed by the results the agent will get back. No filler or redundancy.

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?

An output schema exists, so return values need not be elaborated, and annotations cover the safety profile. The only outstanding gap is the undocumented flags parameter, which keeps this short of a perfect score for a four-parameter tool.

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 coverage is 75%, so the schema carries most of the meaning (pattern without slashes, sample to search, replacement behavior). The description's only added semantic is that replacement is optional and the replaced sample is returned, which largely restates the schema. The flags parameter gets no clarification in either place, but at this coverage level 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 gives a specific verb and resource ('Run a JavaScript regular expression against a sample') and previews the return payload (matches, capture groups, explanation, replacement). It is unambiguous, though it never names or contrasts a sibling, which no other tool in the catalog competes with anyway.

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 only implied by the phrasing 'against a sample' — an agent can infer this is for trying out a regex, but there is no explicit when-to-use, no prerequisites, and no exclusions. For a single-purpose utility tool this is adequate but thin.

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.