Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

move-rule-to-mode

Relocate a lexer rule to a specified mode within an ANTLR4 grammar to fix misplacements and reorganize grammar structure.

Instructions

Move an existing lexer rule to a different mode.

When to use: Reorganizing lexer rules, fixing mode placement, refactoring grammar structure.

Features:

  • Moves lexer rules between modes

  • Preserves rule definition exactly

  • Validates source rule exists and is a lexer rule

  • Validates target mode exists

Example - Move rule to STRING_MODE: rule_name: "STRING_CONTENT" target_mode: "STRING_MODE" write_to_file: true

Note: Parser rules cannot be moved to modes (they don't have mode context).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_fileNoOptional: path to a grammar file to read
rule_nameYesName of the lexer rule to move
output_modeNoOutput format: "full", "diff", or "none"
target_modeYesName of the mode to move the rule to
write_to_fileNoIf true, writes modified grammar back to from_file
grammar_contentNoThe ANTLR4 grammar file content
Behavior3/5

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

Features list discloses validation behaviors and preservation of the rule definition. However, it does not explain side effects like whether the source rule is removed, default write behavior, or what the output modes ('full', 'diff', 'none') produce. With no annotations, these gaps leave important behavioral aspects unexplained.

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?

Well-structured with clear sections: purpose, when-to-use, features, example, and note. Every section earns its place, the example is minimal, and the overall 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.

Completeness3/5

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

The description covers purpose, usage, and validation but omits output behavior and how the tool interacts with the file (e.g., whether write_to_file is required for persistence). Since there is no output schema, the description should explain return values or output modes, which it currently does not.

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% and descriptions are already in the schema. The example adds a concrete usage pattern but does not add meaning beyond the schema fields. It serves as an illustration rather than additional explanation.

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 opening sentence 'Move an existing lexer rule to a different mode' uses a specific verb and resource, and the scope is clearly distinguished from siblings like move-rule (generic) and add-rule-to-mode (create new). The note about parser rules further narrows the purpose to lexer rules only.

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 'When to use' section with three concrete scenarios and an explicit exclusion (parser rules cannot be moved). However, it does not name alternative tools such as 'add-rule-to-mode' or 'move-rule', which could help an agent choose between them.

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