Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

duplicate-mode

Duplicate a lexer mode and all its rules, with optional prefix for cloned rule names. Use it to create similar modes, refactor mode structure, or build templates.

Instructions

Duplicate a lexer mode with all its rules.

When to use: Creating similar modes, refactoring mode structure, creating mode templates.

Features:

  • Copies all rules from source mode to new mode

  • Optional prefix for cloned rule names

  • Creates new mode declaration automatically

Example - Duplicate mode without prefix: source_mode: "STRING_MODE" new_mode: "TEMPLATE_MODE"

Example - Duplicate with rule prefix: source_mode: "STRING_MODE" new_mode: "INTERPOLATION_MODE" prefix_rules: "INTERP_"

Rules will be named: INTERP_STRING_CONTENT, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
new_modeYesName for the new mode
from_fileNoOptional: path to a grammar file to read
output_modeNoOutput format: "full", "diff", or "none"
source_modeYesName of the mode to duplicate
prefix_rulesNoOptional prefix for cloned rule names
write_to_fileNoIf true, writes modified grammar back to from_file
grammar_contentNoThe ANTLR4 grammar file 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. It discloses key behaviors: copies all rules, optional prefix, and automatic creation of a new mode declaration. Examples illustrate naming behavior. However, it does not mention side effects like file writing or output modes, which are left to the schema.

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-organized with sections for purpose, when-to-use, features, and examples. Every sentence serves a purpose, and the examples are concise but informative. No fluff or redundancy.

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 7 parameters and no output schema, the description covers the core functionality thoroughly with examples. It does not explain all parameter interactions (e.g., grammar_content vs from_file, output_mode behavior), but the schema provides descriptions for those, so the overall context is sufficient for an agent to select and invoke the tool.

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 coverage is 100%, giving a baseline of 3. The description adds meaning through examples that clarify the relationship between source_mode, new_mode, and prefix_rules, including how prefixed rule names are generated. Other parameters are adequately described in the schema itself.

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 'Duplicate a lexer mode with all its rules,' using a specific verb and resource. It clearly differentiates from siblings like add-lexer-mode or move-rule-to-mode, which handle single modes or rules.

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 includes a 'When to use' section listing concrete scenarios: 'Creating similar modes, refactoring mode structure, creating mode templates.' It does not explicitly mention when not to use or alternative tools, but the context is clear.

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