Skip to main content
Glama

Test a regex on real engines

test_regex
Read-onlyIdempotent

Run a regex on JavaScript, Python, PCRE2, and RE2 engines to compare matches, groups, replacement results, compile errors, and disagreements, including ReDoS risk.

Instructions

Runs a regex on real engines: JavaScript (V8), Python (CPython re), PCRE2 (PHP, grep -P), RE2 (Go, BigQuery). Each gives its compile error with position, or every match with groups and named groups, and the replacement result in its own syntax. Positions are in characters. Lists where engines disagree.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flagsNoany of i m s x u
inputsYes
flavorsNodefault all four
patternYes
max_matchesNo
replacementNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
enginesYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare the operation safe, idempotent, non-destructive, and closed-world, so the description's job is narrower. It still adds substantial value by disclosing return behavior per engine (compile error with position vs. matches with groups/named groups vs. replacement result in each engine's own syntax) and the character-based position convention. It does not mention input size limits or the 20-input cap.

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, roughly 55 words, front-loaded with the action and engine list, then return format, then the position convention, then the differentiator. Every sentence contributes information; nothing is redundant or padding.

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?

For a 6-parameter tool with an output schema, the description covers the engine set and result shape well enough to call correctly, and the output schema carries return structure. Remaining gaps are flags semantics and max_matches behavior, plus the input array limits, but these are minor against the annotations and output schema.

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 only 33%, so the description must carry weight; it partially does by naming the engines behind the flavors enum and framing what 'replacement' produces. It says nothing about 'flags' (only i m s x u) or 'max_matches', leaving two parameters undocumented in both the schema and the prose.

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?

The description gives a precise verb+resource ('runs a regex on real engines') and immediately enumerates the four concrete engines (V8, CPython re, PCRE2, RE2) with their real-world bindings. This scope is so specific that an agent can trivially separate it from the sibling check_redos, which is about backtracking risk rather than match behavior.

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: it's evident you would call this to compare regex behavior across engines, and 'Lists where engines disagree' hints at the cross-engine comparison use case. However, there is no explicit when-to-use, when-not-to-use, or named alternative (e.g. check_redos) to route the agent.

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