Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

add-parser-rules

Bulk-add parser rules to an ANTLR4 grammar in one operation. Provide rule names and definitions to quickly set up grammar structure or prototype.

Instructions

Add multiple parser rules to a grammar in a single operation (bulk add).

When to use: Set up grammar structure, add multiple related parsing rules, or quickly prototype a grammar.

Example - Add expression rules: rules: [ { name: "program", definition: "statement+" }, { name: "statement", definition: "assignment | ifStatement | whileStatement" }, { name: "assignment", definition: "ID ASSIGN expression SEMI" }, { name: "expression", definition: "term ((PLUS | MINUS) term)*" } ] write_to_file: true

Features:

  • All rules inserted in alphabetical order

  • Duplicate prevention per rule

  • Partial success: some rules can succeed even if others fail

  • Per-rule success/failure reporting

  • Atomic per-rule operations

Returns:

  • Summary: "Added X rules, Y failed"

  • Per-rule results with success/failure status

  • Modified grammar

  • File write confirmation if applicable

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rulesYesArray of parser rules to add. Each rule requires name and definition properties.
from_fileNoOptional: path to a grammar file to read. Required if using write_to_file.
write_to_fileNoIf true, writes modified grammar back to from_file (requires from_file to be set)
grammar_contentNoThe ANTLR4 grammar file content
Behavior5/5

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

With no annotations, the description fully discloses important behaviors: alphabetical insertion, duplicate prevention, partial success, per-rule reporting, and atomic per-rule operations. This is detailed transparency for a mutation tool.

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 clear sections: intro, when-to-use, example, features, returns. Every sentence contributes value, with no fluff or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

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

Given no output schema, the description explicitly describes return values (summary, per-rule results, modified grammar, file confirmation). The example and feature list cover the key use cases, making this complete for a bulk operation 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%, but the description adds a rich example showing the rules array structure and write_to_file usage, which clarifies the relationship between parameters and expected behavior beyond the schema alone.

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 clearly states the tool's function: 'Add multiple parser rules to a grammar in a single operation (bulk add).' This distinguishes it from single-rule tools like add-rule and other sibling tools. The phrase 'bulk add' and the detailed example reinforce the specific scope.

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 an explicit 'When to use' section mentioning setup, adding multiple related rules, and prototyping. It does not explicitly mention when not to use or alternatives, but the context is clear and actionable.

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