Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

find-rule-usages

Locate all references to a specific ANTLR rule with line numbers and context to assess impact before renaming or removing it. Supports imported grammars for cross-file dependency analysis.

Instructions

Find all locations where a specific rule is referenced with line numbers and context.

When to use: Before renaming/removing rules to understand impact, analyze dependencies, or trace rule usage.

Example usage: rule_name: "expression"

Returns:

  • Total usage count

  • Per-usage details: line number, rule context (which rule contains the reference)

  • Complete usage report

Multi-file support:

  • Set load_imports: true to search across imported grammars

  • Useful for finding cross-file dependencies

Use before:

  • Renaming rules (to see what will be affected)

  • Removing rules (to identify breaking changes)

  • Refactoring (to understand dependencies)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_pathNoOptional: base directory for resolving imports. Required for multi-file grammars.
from_fileNoOptional: path to a grammar file to read
rule_nameYesThe name of the rule to find usages for (case-sensitive)
load_importsNoOptional: if true, search across imported grammars. Default: false.
grammar_contentNoThe ANTLR4 grammar file content
Behavior4/5

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

With no annotations provided, the description carries the full behavioral burden. It discloses the return payload (total usage count, per-usage details, complete report) and the multi-file behavior via load_imports. It does not state error behaviors or prerequisites, but for a read-only tool the core actions and outputs are clearly conveyed.

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 (When to use, Example usage, Returns, Multi-file support, Use before). It is slightly longer than necessary, and the 'Use before' section partially repeats the 'When to use' content, but every section contributes to practical usage. Overall it is effective and not bloated.

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?

Given the tool has 5 parameters, no output schema, and no annotations, the description covers the key aspects: what it does, when to use it, what it returns, and a notable multi-file option. It could be more complete with error handling or prerequisites, but it is sufficient for an agent to select and invoke the tool correctly in most situations.

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 baseline is 3. The description adds some context beyond the schema, such as the example usage for rule_name and the purpose of load_imports for cross-file dependencies. However, it does not significantly enrich the understanding of base_path, from_file, or grammar_content, which are already well described in the schema.

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 a specific verb and resource: 'Find all locations where a specific rule is referenced with line numbers and context.' This clearly distinguishes it from siblings like find-rule (which locates a rule definition) and impact-analysis (which assesses impact). The purpose is unambiguous and actionable.

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 description provides explicit 'When to use' and 'Use before' sections, listing concrete scenarios like renaming, removing, and refactoring rules. However, it does not explicitly mention when not to use the tool or name alternatives, so it falls short of the 5-level criteria but is still strong 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