Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

add-tokens-with-template

Batch add multiple ANTLR4 lexer tokens using a template pattern, with custom naming, skip/channel/fragment options, and per-rule success feedback.

Instructions

Add multiple similar lexer tokens at once using template-based generation.

When to use:

  • Add multiple tokens that follow a similar pattern

  • Generate tokens for command sequences (e.g., "config system X", "set X Y")

  • Batch-add tokens with consistent naming conventions

Example - Add tokens for "config system X" patterns: base_names: ["ftm-push", "dns", "firewall", "admin"] preceding_tokens: ["SYSTEM", "CONFIG"]

Example - Add multiple keyword tokens: base_names: ["enable", "disable", "show", "hide"] pattern: "'{NAME}'"

Example - Add tokens with custom pattern: base_names: ["tcp", "udp", "icmp"] pattern: "'protocol-{NAME}'"

Features:

  • Automatically generates proper token names (uppercase with underscores)

  • Supports custom patterns with {NAME} placeholder

  • Uses existing bulk add infrastructure for reliability

  • All standard options supported (skip, channel, fragment)

Returns:

  • Generated rules list

  • Per-rule success/failure status

  • Modified grammar

  • Summary of results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
skipNoIf true, adds "-> skip" directive to all generated tokens
channelNoOptional: Channel name for all generated tokens
patternNoOptional: Custom pattern template. Use {NAME} as placeholder for base name. Default: '{NAME}'
fragmentNoIf true, marks all generated tokens as fragments
from_fileNoOptional: path to a grammar file to read. Required if using write_to_file.
base_namesYesBase names for tokens (e.g., ["ftm-push", "dns", "firewall"])
write_to_fileNoIf true, writes modified grammar back to from_file
grammar_contentNoThe ANTLR4 grammar file content
preceding_tokensNoOptional: Tokens that precede these (for documentation purposes)
Behavior4/5

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

With no annotations provided, the description carries the transparency burden. It discloses core behaviors: automatic uppercase/underscore naming, {NAME} placeholder support, reliance on 'existing bulk add infrastructure', and a clear return summary including per-rule status and modified grammar. It lacks specifics on failure handling but is adequate for an additive tool.

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 longer than minimal, but every section (when-to-use, examples, features, returns) earns its place. It's front-loaded with the main purpose, uses headers for scannability, and avoids filler. Slightly verbose but well-structured.

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?

For a 9-parameter tool with no output schema, the description covers the what, when, and returns sufficiently. It illustrates usage with multiple examples and lists return values. It doesn't address edge cases like error handling or file I/O interactions, but given schema coverage and the additive nature, it's reasonably complete.

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%, so baseline is 3. The description adds value beyond schema by explaining the {NAME} placeholder convention, providing concrete examples for base_names and preceding_tokens, and noting default pattern behavior. It doesn't detail every parameter but compensates for the core ones.

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+resource phrase: 'Add multiple similar lexer tokens at once using template-based generation.' It clearly distinguishes from sibling tools like add-rule or generate-tokens-from-pattern by emphasizing batch template-based creation.

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 provides explicit contexts (e.g., 'Add multiple tokens that follow a similar pattern', 'Generate tokens for command sequences'). However, it does not name alternatives or provide when-not-to-use guidance, so it's clear but without exclusions.

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