Skip to main content
Glama

Probar expresión regular

regex-test
Read-onlyIdempotent

Aplica una expresión regular de JavaScript a un texto y lista cada coincidencia con posición y grupos (hasta 500). Corre en un contexto vm que se detiene a los 50 ms: un patrón catastrófico responde timeout. Cuándo: hay que transformar, comparar o medir un texto con exactitud y no por aproximación. No para: reemplazar coincidencias de una expresión regular (regex-replace). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.

EN: Tries a JavaScript regex on a text and lists each match with its position and groups (up to 500). The pattern runs in a separate vm context that is stopped after 50 ms, so a catastrophic pattern returns timeout instead of hanging. Pattern ≤ 500 chars. When: text has to be transformed, compared or measured exactly instead of approximated. [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
textYesSubject text (string; required).
flagsNoFlags from dgimsuyv (string; optional; default ""; up to 8 chars; pattern ^[dgimsuyv]*$).
patternYesJavaScript regular expression source (no slashes) (string; required; at least 1 chars; up to 500 chars).

Output Schema

NameRequiredDescriptionDefault
countNo
matchedNo
matchesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / pattern / examples
      Added value: +[
      +  "(\\d+)-(\\d+)"
      +]
    • addedInput schema / properties / text / examples
      Added value: +[
      +  "a 10-20 b 3-4"
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Tries a JavaScript regex on a text and lists each match with its position and groups (up to 500). The pattern runs in a separate vm context that is stopped after 50 ms, so a catastrophic pattern returns timeout instead of hanging. Pattern ≤ 500 chars. When: text has to be transformed, compared or measured exactly instead of approximated. Not for: replacing regex matches (regex-replace). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB."
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes well past the annotations: discloses that the pattern executes in an isolated vm context killed at 50 ms so catastrophic patterns return timeout instead of hanging, plus concrete limits (64 KB JSON input, 1 s per call, 1 MB result) and determinism. The 'no side effects' line merely restates readOnlyHint, but the sandbox/timeout and quota disclosure is exactly the behavioral context an agent cannot infer elsewhere.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The Spanish block is front-loaded and dense, with labeled clauses (Cuándo / No para / Efectos secundarios / Límites) that are easy to scan. The appended English block largely duplicates it and points back to inputSchema.description, which is mild redundancy rather than bloat.

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?

Return shape is covered by the output schema, parameters by a fully-described schema, and safety by annotations; the description fills the remaining gaps (timeout behavior, quotas, replacement alternative). Nothing an agent needs in order to call it correctly is missing.

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 100%, so pattern/flags/text semantics are already fully documented, including the flags pattern ^[dgimsuyv]*$. The description adds only the pattern length cap (already in the schema as maxLength) and the 500-match result ceiling, which is output behavior rather than parameter meaning.

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: applies a JavaScript regex to a text and lists every match with position and groups (capped at 500). It also names the sibling it is not (regex-replace), so an agent can separate the two without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The 'Cuándo' clause gives the positive trigger (exact transform/compare/measure of text, not approximation) and the 'No para' clause routes replacement work to regex-replace. Both the use case and the exclusion are explicit.

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