Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

rule-statistics

Analyze a rule's complexity, dependencies, recursion, and usage statistics to identify bottlenecks and refactoring priorities.

Instructions

Analyze rule complexity, dependencies, and performance characteristics.

When to use: Understand rule complexity, identify bottlenecks, find heavily-used rules, plan refactoring.

Example usage: rule_name: "expression"

Returns:

  • Rule definition and type

  • Complexity metrics: number of alternatives

  • Fan-out: rules that this rule references (dependencies)

  • Fan-in: rules that reference this rule (dependents)

  • Recursion analysis: direct/indirect recursion detection

  • Usage statistics

Use cases:

  • Identify complex rules for optimization

  • Find highly-coupled rules

  • Detect recursion issues

  • Plan refactoring priorities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_fileNoOptional: path to a grammar file to read
rule_nameYesThe name of the rule to analyze (case-sensitive)
grammar_contentNoThe ANTLR4 grammar file content
Behavior4/5

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

The description is detailed about what the tool returns (rule definition, complexity metrics, fan-out/fan-in, recursion analysis, usage statistics) and includes an example usage. There are no annotations, so the description carries the burden, and it effectively discloses the analytical behavior, though it does not explicitly state read-only semantics or error conditions.

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 with clear sections (intro, when to use, example, returns, use cases) and front-loaded with the primary purpose. It is slightly redundant (returns and use cases overlap), but each section earns its place and the length is appropriate for the tool's complexity.

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?

There is no output schema, so the description compensates by explicitly listing return categories (complexity metrics, fan-out, fan-in, recursion analysis, usage statistics). It covers use cases and example input, making the tool understandable. Minor gaps include lack of error-handling details and explicit read-only confirmation, but overall it is complete for an analysis tool.

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 provides 100% coverage for all parameters, including descriptions for rule_name, from_file, and grammar_content. The description adds one example usage ('rule_name: "expression"') but does not enrich the parameter meanings beyond what the schema already offers, so baseline 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 clearly states the tool analyzes rule complexity, dependencies, and performance characteristics for specific rules. It distinguishes from sibling tools like grammar-metrics or analyze-grammar by focusing on individual rule analysis with specific outputs like fan-in/fan-out and recursion detection.

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 listing concrete scenarios (understand complexity, identify bottlenecks, find heavily-used rules, plan refactoring). It gives clear context for when to apply the tool, though it does not explicitly mention when not to use it or name alternative tools.

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