Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

native-benchmark

Benchmark ANTLR4 grammars using the actual ANTLR4 Java runtime to get accurate parse times, throughput, and performance ratings for final testing and grammar comparison.

Instructions

Benchmark grammar using actual ANTLR4 Java runtime (most accurate).

When to use: Final performance testing, comparing grammars, production validation.

Requirements:

  • Java must be installed

  • ANTLR4 JAR must be available (auto-downloads to ~/.local/lib/)

Features:

  • Uses real ANTLR4 parser (100% accurate)

  • Low-overhead Java driver (avoids JVM startup per iteration)

  • Warmup iterations for JIT optimization

  • Supports multi-file grammars

Parameters:

  • grammar_files: Object mapping filename to content {"Expr.g4": "grammar Expr..."}

  • start_rule: Parser rule to start from

  • input: Sample input text

  • iterations: Timed iterations (default: 10)

  • warmup_iterations: Warmup runs (default: 3)

Example: grammar_files: {"Expr.g4": "grammar Expr; start: expr EOF; ..."} start_rule: "start" input: "1 + 2 * 3" iterations: 20

Returns:

  • Avg/min/max parse time

  • Throughput (chars/sec, tokens/sec)

  • Performance rating (excellent/good/fair/slow)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesInput text to parse
iterationsNoNumber of timed iterations (default: 10)
start_ruleYesParser rule to start parsing from
grammar_filesYesMap of filename to grammar content
warmup_iterationsNoWarmup runs before timing (default: 3)
Behavior4/5

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

With no annotations, the description carries full responsibility for behavioral disclosure. It reveals meaningful details such as auto-downloading the ANTLR JAR to ~/.local/lib/, using a low-overhead Java driver, and performing warmup iterations. This goes well beyond a simple 'benchmark' label.

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-organized into clear sections (When to use, Requirements, Features, Parameters, Returns). The parameter section somewhat redundantly repeats schema descriptions, but the overall structure is scannable and each section contributes useful context.

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?

Although there is no output schema, the description explicitly lists return values (avg/min/max, throughput, performance rating), requirements, and an example. This makes the tool's behavior and results understandable without needing additional documentation. It is comprehensive given the tool's complexity.

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 coverage is 100%, so the schema already documents all parameters. The description duplicates this information but adds a concrete example of grammar_files and start_rule usage. This provides marginal value beyond the schema, matching the baseline for high schema coverage.

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 benchmarks grammars using the actual ANTLR4 Java runtime, which is a specific and distinct action. It emphasizes 'most accurate' and differentiates from sibling benchmarking tools by highlighting the real runtime.

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 'When to use' section explicitly names final performance testing, comparing grammars, and production validation. It provides clear context but does not explicitly list exclusions or alternative tools, so it falls just 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