Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

create-grammar-template

Create a new ANTLR4 grammar from scratch with optional lexer modes and boilerplate rules. Scaffold lexer, parser, or combined grammar.

Instructions

Create a new ANTLR4 grammar from scratch with optional mode structure.

When to use: Starting a new grammar project, scaffolding grammar structure, creating grammar templates.

Features:

  • Creates lexer, parser, or combined grammar

  • Optionally includes boilerplate rules (WS, ID, NUMBER, STRING, comments)

  • Adds specified modes with placeholder comments

  • Ready-to-use structure for common patterns

Example - Simple lexer grammar: grammar_name: "MyLexer" type: "lexer"

Example - Lexer with modes: grammar_name: "TemplateLexer" type: "lexer" modes: ["STRING_MODE", "COMMENT_MODE", "INTERPOLATION_MODE"] include_boilerplate: true

Example - Combined grammar: grammar_name: "Calculator" type: "combined" include_boilerplate: true

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoType of grammar to create (default: lexer)
modesNoList of mode names to include in the grammar
grammar_nameYesName for the new grammar
grammar_contentNoPlaceholder - not required for this tool
include_boilerplateNoInclude common rules like WS, ID, NUMBER, STRING (default: true)
Behavior3/5

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

With no annotations, the description carries the full burden but only partially discloses behavior. It mentions creating lexer/parser/combined grammars, including boilerplate rules, and adding modes with placeholder comments, which is useful. However, it does not explain what the tool returns (e.g., a string of grammar text), whether it writes to files, or any side effects. The examples show inputs but not output format, so an agent might be uncertain about the result.

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-structured with a purpose line, when-to-use, features, and examples. It is longer than the two-sentence ideal, but the extra length is justified for a tool with multiple options. The front-loaded purpose and clear section headings make it easy to scan. Every section contributes, though the 'Features' section partly restates the purpose.

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 no output schema and no annotations, the description provides a solid overall picture: purpose, usage scenarios, features, and examples. It does miss explicit mention of the return value or output format, which would be helpful for an agent. However, the examples strongly imply the generated grammar template is the output, and the tool is relatively simple. The description is complete enough for basic selection and invocation.

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 description coverage is 100%, so the schema already documents each parameter. The description adds value by providing three concrete examples that show how parameters combine (e.g., modes array, include_boilerplate). These examples clarify usage beyond the schema's field descriptions, especially for the modes parameter. This goes beyond the baseline 3 but doesn't add syntax-level details.

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: 'Create a new ANTLR4 grammar from scratch with optional mode structure.' It clearly distinguishes this tool from siblings like add-rule or validate-grammar by focusing on whole-grammar creation. The 'When to use' section reinforces the purpose with explicit use cases.

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 explicitly lists three appropriate scenarios, providing clear context for when to choose this tool. It does not explicitly name alternatives or say when NOT to use it, but the examples cover the main variation (types and modes). This earns a 4, not 5, because exclusions are only implied by the sibling list.

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