Production-ready MCP server for ANTLR4 grammar validation, parsing, and analysis
This server presents well-structured, domain-specific tools for ANTLR4 grammar analysis with comprehensive descriptions and clear input schemas. However, it lacks output schema documentation, error handling guidance, and proper tool composition patterns. All 9 tools have descriptions (194-260 chars on average, aligning with the 194-char baseline), and input parameters are well-typed with enums where appropriate. The main gaps are: (1) no documented output schemas for any tool, forcing LLMs to infer response structure; (2) missing error recovery guidance in descriptions; (3) no tool annotations (readOnlyHint, destructiveHint); (4) some parameter descriptions could be more actionable (e.g., 'output_format' lacks guidance on when to use each format). The server is domain-competent but falls short of production-grade readiness due to lack of response documentation and error patterns.
Analyze grammar rule call graph to show dependencies, detect cycles, and identify unused rules. Supports DOT and Mermaid output formats for visualization.
Compute FIRST and FOLLOW sets for ANTLR4 grammar rules. FIRST sets show what tokens can start a rule's derivation. FOLLOW sets show what tokens can appear after a rule. Also analyzes decision points for lookahead conflicts. Returns nullable rules, LL(1) conflicts, and ambiguous decisions. Essential for understanding parser behavior and debugging conflicts.
Analyze left recursion patterns in an ANTLR4 grammar. Detects direct left recursion (A -> A α) and indirect cycles. Returns information about how ANTLR4 transforms recursive rules, which helps understand precedence handling and optimize grammar performance. Essential for compiler engineers debugging expression grammars.
Compile ANTLR4 grammar for a specific target language (Java, Python, JavaScript, TypeScript, C++, C#, Go, Swift, PHP, or Dart). Returns generated file list and optionally the generated code. This tool validates the grammar and generates language-specific parser code.
Analyzes ANTLR4 grammar for ambiguities, conflicts, and prediction issues using static analysis. Reports line/column of ambiguous rules, conflicting alternatives, and lookahead conflicts with technical explanations.
No documented output schemas for any tool. Tools return complex structures (parse trees, ATN visualizations, analysis reports) without formalizing response fields or types. LLMs cannot plan chained calls or extract specific data without inferring response structure from the description alone, increasing hallucination risk.
Missing error handling guidance in tool descriptions. Descriptions do not explain what counts as recoverable vs fatal errors, or what the LLM should do if a tool fails (e.g., if grammar validation finds errors, can the LLM fix them or must it ask the user?). Descriptions mention what errors are detected (e.g., 'syntax errors, undefined rules') but not how they are reported or what the LLM should do next.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-21 | D | 59 | <=2025-11-25 | v2 |
| 2026-03-09 | C | 62 | - | v1 |
Parse input using ANTLR4 grammar. Uses fast interpreter mode. Returns LISP-format parse tree, token stream, and parse errors. Essential for testing grammar rules during development.
Profile grammar performance by parsing sample input. Analyzes decision complexity, lookahead requirements, and provides optimization hints.
Validates ANTLR4 grammar syntax and reports errors with actionable fixes. Checks for syntax errors, undefined rules, and basic structural issues.
Generate ATN (Augmented Transition Network) state machine visualization for a grammar rule. The ATN is ANTLR's internal representation of grammar rules as state machines. Supports DOT, Mermaid, and SVG output formats. Useful for understanding parser internals and debugging complex grammar rules.
No tool annotations (readOnlyHint, idempotentHint, destructiveHint). All 9 tools are read-only analyses and safe to retry, but this is not declared. The MCP spec allows tools to signal these safety properties, enabling agents to make smarter decisions about caching, retries, and parallel execution. The lack of annotations forces agents to infer safety from descriptions alone.
Some parameter descriptions are sparse or undirected. 'output_format' in analyze_call_graph (description: 'Output format: json (default), dot, or mermaid') lacks guidance on when to use each format or what each contains. 'sample_inputs' in detect_ambiguity (description: 'Optional sample inputs to test for ambiguities') is vague, unclear if these are test cases or hints for analysis.
profile_grammar has a notably short description (115 chars, below the 194-char baseline). It explains what it does but lacks context on when to use it vs other analysis tools (e.g., when to call profile_grammar instead of analyze_first_follow or detect_ambiguity). Description should clarify the difference in purpose and use cases.
Tool composition could be clearer. Tools like compile_grammar_multi_target and parse_sample both accept grammar_text and might be called in sequence, but it's not documented what fields the user should pass between calls or what output from one tool feeds into another. No tool chaining guidance.