Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

profile-parsing

Profile grammar parsing to get performance metrics like parse time, token count, tree depth, ambiguity count, and optimization suggestions for debugging slow parsing.

Instructions

Profile grammar parsing with detailed performance metrics.

When to use: Deep performance analysis, debugging slow parsing, optimizing grammars.

Measures:

  • Parse time (ms)

  • Token count

  • Parse tree depth

  • Decision evaluations (ATN transitions)

  • Ambiguity count (conflicting alternatives)

  • Context sensitivity (SLL→LL fallbacks)

  • Rule invocation frequency

Parameters:

  • grammar_files: Object mapping filename to content

  • start_rule: Parser rule to start from

  • input: Sample input text

Returns:

  • Detailed profile metrics

  • Most frequently invoked rules

  • Optimization suggestions

Example: grammar_files: {"Expr.g4": "grammar Expr; ..."} start_rule: "program" input: "x = 1 + 2 * 3"

Interpretation:

  • ambiguityCount > 0: Grammar has ambiguous alternatives

  • contextSensitivityCount > 10: Many SLL→LL fallbacks (slow)

  • treeDepth > 100: Excessive nesting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesInput text to parse
start_ruleYesParser rule to start parsing from
grammar_filesYesMap of filename to grammar content
Behavior4/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It adds rich context through the 'Measures' and 'Interpretation' sections, explaining exactly what gets analyzed and how to interpret the results (e.g., ambiguityCount > 0 means ambiguous alternatives). It doesn't mention side effects or permissions, but the profiling nature is clear and the description goes beyond a bare 'Profile parsing' statement.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (When to use, Measures, Parameters, Returns, Example, Interpretation). Every section provides necessary information, and the content is front-loaded with the core purpose. No redundant or filler sentences.

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?

Given the tool's moderate complexity (3 params, no output schema, no annotations), the description is very complete. It explains the return values explicitly (profile metrics, frequent rules, optimization suggestions) and provides interpretation thresholds for key metrics, which is critical for an AI agent to understand the output without a schema.

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 description coverage is 100%, so baseline is 3. The description restates the parameters with concise meanings and adds a concrete example showing expected values for grammar_files, start_rule, and input. This example adds practical meaning beyond the 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 states a specific action: 'Profile grammar parsing with detailed performance metrics.' It clearly identifies the resource (grammar parsing) and the goal (performance analysis), and distinguishes itself from sibling tools by listing concrete measures like parse time, ambiguity count, and context sensitivity.

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 says 'Deep performance analysis, debugging slow parsing, optimizing grammars,' providing clear context for when to invoke this tool. However, it doesn't explicitly mention when not to use it or name alternative tools, so it stops short of full exclusionary guidance.

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