Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

compile-grammar

Run native ANTLR4 compilation checks to catch grammar syntax and tooling errors, providing diagnostics with line/column, timing, and generated artifacts.

Instructions

Run native ANTLR4 compilation checks for grammar syntax/tooling errors.

When to use: Before committing grammar edits, after refactors, or when validate-grammar looks clean but ANTLR toolchain still fails.

Supports:

  • ANTLR4 native diagnostics (error/warning with line/column)

  • Multi-file imports/tokenVocab with load_imports=true and from_file

  • Compile timing and generated file summary

Example usage: from_file: "MyGrammar.g4" load_imports: true

Returns: compile success/failure, native diagnostics, timing, generated artifacts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_pathNoOptional: base directory for resolving imports/tokenVocab. Defaults to from_file directory.
from_fileNoOptional: path to grammar file to compile (recommended for import-aware checks)
load_importsNoOptional: if true, loads imported grammars and tokenVocab grammars before compile. Default: true.
grammar_contentNoThe ANTLR4 grammar content (optional when from_file is provided)
Behavior4/5

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

With no annotations, the description must carry the full behavioral burden. It discloses the nature of diagnostics (error/warning with line/column), import/tokenVocab loading behavior, compile timing, and return contents. It does not explicitly state whether the operation is read-only, but 'checks' implies no mutation, so the transparency is strong.

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 well-structured with a bold 'When to use' section, bulleted supports, an example, and a returns line. It is slightly verbose, but every section earns its place, and the key verb is front-loaded. Minor redundancy with schema details prevents a 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite no output schema and no annotations, the description covers the tool's purpose, usage guidance, supported features, an example, and explicit return values (success/failure, diagnostics, timing, generated artifacts). This is fully sufficient for an agent to select and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds relational meaning by linking load_imports=true and from_file to multi-file imports/tokenVocab, and the example usage clarifies the recommended parameter combination. This goes beyond the raw schema definitions.

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 'Run native ANTLR4 compilation checks for grammar syntax/tooling errors,' which uses a specific verb and resource. It distinguishes this tool from the sibling validate-grammar by emphasizing 'native' and 'tooling errors,' making the purpose clear and unique.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It includes an explicit 'When to use' section that names validate-grammar as an alternative and specifies the condition: 'when validate-grammar looks clean but ANTLR toolchain still fails.' This directly tells the agent when to prefer this tool over a sibling.

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