Skip to main content
Glama
kinbinghua-lgtm

agent-core-mcp

regex_analyze

Read-onlyIdempotent

Statically analyze a regex for ReDoS risks without executing it. Returns risk level and reasons such as nested quantifiers, overlapping alternation, or backreferences.

Instructions

Statically analyse a regular expression for catastrophic backtracking (ReDoS): nested quantifiers, overlapping alternation inside repeated groups, backreferences under quantifiers, excessive wildcards. Returns a risk level and the specific reasons. The pattern is not executed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesRegular expression source to analyse

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, so the bar is lower. The description still adds real value beyond them: it enumerates the specific hazards detected (nested quantifiers, overlapping alternation, backreferences under quantifiers, excessive wildcards) and explicitly states the pattern is not executed, which matters for safety-sensitive callers.

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?

Three tight sentences, front-loaded with the purpose, then the detection scope, then the return shape. Every sentence earns its place with no filler.

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?

With no output schema, the description correctly compensates by describing the return ('a risk level and the specific reasons'). It could go slightly further by naming the risk-level values or flagging that only heuristic static analysis is performed, but an agent has enough to call and interpret it.

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?

There is a single parameter and the schema already documents it fully (100% coverage: 'Regular expression source to analyse'). The description adds no syntax or format guidance beyond that, so 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?

The description names a specific verb and resource ('statically analyse a regular expression') and states the exact problem domain (catastrophic backtracking / ReDoS). It is easily distinguished from the sibling regex_extract, which extracts rather than analyses.

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 implied by the nature of the tool — you use it to vet a pattern for ReDoS risk — and 'The pattern is not executed' hints it is a safe pre-flight check. However, it never states when to prefer this over alternatives or when analysis is unnecessary, so guidance remains implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.