Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

detect-quantifier-issues

Identifies suspicious quantifier patterns in ANTLR4 grammars that cause parsing failures, and suggests corrected quantifier usage.

Instructions

Detect suspicious quantifier patterns that may prevent parsing real configs.

When to use: After seeing "unrecognized syntax" warnings or when rules don't match multi-line configs.

Common patterns detected:

  1. Rule names with _rule, _setting, _property using ? instead of * → bgpp_export: EXPORT bgp_policy_rule? should be *

  2. Multiple optional elements that should be alternatives → source? destination? action? should be (source | destination | action)*

  3. Same optional reference appearing multiple times → rule: setting? ... setting? should use setting*

Real-world example: Rule: srs_definition: ... source_setting? destination_setting? action_setting? Issue: Config has multiple 'set source', 'set destination' lines Fix: Change to (source_setting | destination_setting | action_setting)*

Returns: List of suspicious patterns with suggestions and reasoning.

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 provided, the description carries the full burden of behavioral disclosure. It discloses the return format ('List of suspicious patterns with suggestions and reasoning') and provides illustrative examples of detected patterns. It does not explicitly state whether it modifies the grammar, but given the verb 'detect' and the return description, the read-only nature is implied. It could benefit from a non-destructive statement but currently offers good transparency.

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 description is structured with clear sections (When to use, Common patterns detected, Real-world example, Returns). While it is longer than a typical two-sentence description, every section adds value by providing concrete examples and reasoning. The front-loaded purpose sentence is strong. It is well-organized and not unnecessarily verbose.

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?

No output schema exists, but the description provides a clear return description. For a detection tool with two simple parameters, the description covers purpose, usage context, common patterns, an example, and return behavior. It lacks explicit edge-case or error-handling information, but given the tool's complexity, it is reasonably complete.

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?

The input schema already provides descriptions for both parameters (from_file and grammar_content), achieving 100% coverage. The tool description does not add additional parameter semantics or mention how the parameters are used. According to the rubric, a baseline of 3 is appropriate when schema coverage is high and the description does not compensate further.

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 clearly states the tool's function: 'Detect suspicious quantifier patterns that may prevent parsing real configs.' It specifies a specific verb, resource, and scope, and distinguishes itself from sibling tools like fix-quantifier-issues by focusing on detection rather than fixing. The concrete patterns and examples reinforce a distinct purpose.

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 includes an explicit 'When to use' section ('After seeing "unrecognized syntax" warnings or when rules don't match multi-line configs'), providing clear context for usage. However, it does not explicitly mention alternatives or cases where this tool should not be used, such as referencing fix-quantifier-issues as the follow-up step.

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