Skip to main content
Glama

Escudo Anti-ReDoS

detect_redos_risk

Analiza el código fuente de una herramienta/agente que compila o aplica una expresión regular, en busca de (1) un patrón con forma de "cuantificador anidado" (backtracking catastrófico, ej. (a+)+, (\s*\w+), (a|a)) aplicado contra una entrada que no es un texto fijo, sin ningún tope de longitud ni motor con timeout/librería segura (re2, safe-regex, recheck) reconocibles cerca — un solo string cuidadosamente armado puede colgar el proceso del agente entero (ReDoS, CWE-1333); y (2) un regex compilado dinámicamente (RegExp()/new RegExp()/re.compile()) a partir de una fuente que NO es un texto fijo que escribió el desarrollador, sino una variable — quien llame a la herramienta puede inyectar directamente un patrón catastrófico o cambiar por completo la lógica de validación. El mismo patrón detrás de CVE-2026-0621 (CVSS 7.5). Es un análisis estático por patrones de texto (no ejecuta el código ni mide tiempos reales de backtracking) — mismo enfoque que detect_dynamic_code_risk y detect_ssti_risk. Requiere una llave de acceso válida (usos gratis o créditos) — ver POST /crear-llave.

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": {
      "codigo": "<codigo>"
    },
    "name": "detect_redos_risk"
  }
}

Input Schema

NameRequiredDescriptionDefault
codigoYesEl código fuente que compila o aplica una expresión regular, en texto plano.
lenguajeNoSolo informativo (ej. "javascript", "python") — la detección ya cubre varios lenguajes a la vez, este campo no cambia el resultado.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the methodology limit (static text-pattern analysis, does not execute code or measure real backtracking times) and the auth prerequisite (valid key, free uses or credits, see POST /crear-llave). The remaining gap is that it never says what the response contains — findings, severity, or matched locations — and no output schema exists to cover that.

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

Conciseness3/5

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

The core is front-loaded ("Analiza el código fuente ... en busca de (1) ... y (2)"), but it is delivered as one very long sentence with deeply nested parentheticals containing examples, CWE, CVE, and CVSS references, which is hard to parse on first read. The information is mostly substantive, but the packaging costs readability.

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 two-parameter static scanner with full schema coverage, the description supplies method, scope, limitations, and the auth requirement — everything needed to decide to call it. The one missing piece an agent would want, the shape of the findings returned, is unaddressed and there is no output schema to compensate.

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 both `codigo` and `lenguaje` are already documented, including that `lenguaje` is informational only. The description adds no parameter-level meaning beyond that — its discussion of "entrada que no es un texto fijo" concerns the analyzed code, not the inputs to this tool. Baseline 3 applies.

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 concrete verb ("Analiza el código fuente") plus the exact resource (code that compiles or applies a regex) and enumerates the two specific defect classes it looks for: nested-quantifier catastrophic backtracking and dynamically compiled patterns. It also differentiates itself from siblings by noting it uses the same approach as detect_dynamic_code_risk and detect_ssti_risk, so an agent can place it in the family 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 Guidelines4/5

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

The description gives detailed trigger conditions (nested quantifier applied to non-fixed input with no length cap and no safe engine; RegExp()/re.compile() fed from a variable rather than a developer-written literal), which is strong implied guidance on when a finding is warranted. What's missing is explicit routing — it never says when to prefer a sibling detector or when this scan is unnecessary.

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