Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

detect-incomplete-parsing

Identify ANTLR4 grammar rules that silently discard content (null_rest_of_line, broad negations) and get fixes to parse the full structure.

Instructions

Detect incomplete parsing patterns (anti-patterns that discard content).

When to use: When grammar parses configs but doesn't capture structure, or uses placeholder patterns.

Anti-patterns detected:

  1. null_rest_of_line usage → Discards content instead of parsing it → Example: ss_ssl_tls_service_profile: ... null_rest_of_line → Problem: Loses protocol-settings, certificates, etc.

  2. Overly broad negation patterns → Example: rule: ~[\r\n]+ (matches "anything until newline") → Better: Define specific tokens for expected content

Real-world impact:

  • ss_ssl_tls_service_profile used null_rest_of_line

  • Lost: protocol-settings min-version/max-version, certificate options

  • Result: Thousands of warnings about unparsed structure

Recommendations:

  • Replace null_rest_of_line with actual structure

  • Define specific lexer tokens instead of broad negations

  • Implement proper parser rules for complex structures

Returns: List of incomplete parsing patterns with suggestions.

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 burden of behavioral disclosure. It explains the anti-patterns detected, provides real-world impact, and states the return type ('List of incomplete parsing patterns with suggestions'). It does not mention side effects, permissions, or error behavior, but for a non-mutating analysis tool this is strong coverage.

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 headings (when to use, anti-patterns, impact, recommendations) and front-loaded with the core purpose. It is longer than necessary but each section adds value, and the use of bullet points and examples improves 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?

The tool has only two optional parameters and no output schema. The description provides enough context for usage: it explains what the tool does, when to use it, and what it returns. It could be slightly more detailed about return structure or edge cases, but for the tool's complexity it is sufficiently 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 describes both parameters ('from_file' and 'grammar_content') with 100% coverage. The description does not add new parameter-specific semantics beyond the schema, so the baseline of 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 opens with a specific verb and resource: 'Detect incomplete parsing patterns (anti-patterns that discard content).' It clearly distinguishes this from sibling tools like validate-grammar or detect-redos by focusing on anti-patterns that discard content, with concrete examples.

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 a clear 'When to use' section stating it is for grammars that parse configs but don't capture structure, or use placeholder patterns. It gives clear context but does not explicitly name sibling tools as alternatives or state when not to use it, so it falls short of a 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