Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

detect-redos

Detect ReDoS vulnerabilities in ANTLR4 lexer patterns to prevent denial-of-service attacks. Provides severity, line numbers, and suggestions for each risky pattern.

Instructions

Detect ReDoS (Regular Expression Denial of Service) vulnerabilities in lexer patterns.

When to use: Security audit, performance optimization, validating lexer patterns.

Detects:

  • Nested quantifiers: (a+)+, (a*)*

  • Overlapping alternatives: (a|a)+

  • Alternatives with common prefix: (ab|ac)

  • Unbounded repetition of broad character classes

  • Multiple optional elements in sequence

Returns:

  • List of vulnerabilities with severity (high/medium/low)

  • Line numbers and affected rules

  • Specific suggestions for each issue

Example: from_file: "MyLexer.g4"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_fileNoOptional: path to a grammar file to read
grammar_contentNoThe ANTLR4 grammar file content
Behavior4/5

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

With no annotations, the description carries the full burden. It clearly discloses what is detected and what is returned (list with severity, line numbers, suggestions). It does not explicitly state whether the tool is read-only or whether grammar must be valid, but the analysis nature implies no side effects. The detailed output description adds transparency.

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?

The description is well-structured with clear sections: purpose, when to use, detections, returns, and an example. It is informative without being verbose, each sentence adds value, and it is front-loaded with the core purpose.

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?

Given the tool's complexity (multiple detection patterns) and no output schema, the description adequately explains return values and usage context. It includes an example and covers when to use. It could be slightly improved by explicitly stating it works on ANTLR lexer grammars, but the .g4 example implies this.

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 baseline is 3. The description provides a usage example with from_file, but does not elaborate on grammar_content beyond the schema. It adds marginal value with the example but does not significantly enhance parameter understanding.

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 states 'Detect ReDoS vulnerabilities in lexer patterns' with a specific verb and resource. It lists concrete detection patterns (nested quantifiers, overlapping alternatives) and includes an example, distinguishing it from sibling analysis tools like validate-grammar or detect-quantifier-issues.

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?

Provides explicit 'When to use' with three scenarios: security audit, performance optimization, validating lexer patterns. However, it does not mention when not to use or explicitly compare to alternatives like detect-quantifier-issues, so it falls short of a full 5.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/natl-set/antlr4-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server