Skip to main content
Glama
natl-set

ANTLR4 MCP Server

by natl-set

infer-formatting

Infer the formatting style of an ANTLR4 grammar, including indentation and symbol placement, to preserve conventions when editing.

Instructions

Analyze an ANTLR4 grammar and infer its formatting style.

When to use: Understand the formatting conventions used in a grammar, or verify that formatting will be preserved when making changes.

Example usage: from_file: "MyGrammar.g4"

Analyzes:

  • Colon placement (same-line vs new-line after rule name)

  • Semicolon placement (same-line vs new-line after definition)

  • Space before colon (e.g., "rule :" vs "rule:")

  • Indentation style (spaces or tabs, and how many)

  • Blank lines between rules

Returns: Formatting style object with detected patterns.

Note: The update-rule, add-lexer-rule, and add-parser-rule tools automatically use this inference to preserve your grammar's formatting style.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_fileNoOptional: path to a grammar file to read
grammar_contentNoThe content of the ANTLR4 grammar file
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 exactly what is analyzed (colon/semicolon placement, spacing, indentation, blank lines) and that it returns a formatting style object. The 'Note' about other tools using this inference adds useful behavioral context. It doesn't discuss edge cases or error behavior, but coverage is solid.

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 bold headings and bullet points. The description is appropriately sized—every section earns its place, including the example usage and the note about automatic usage. No fluff.

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 read-only analysis tool with no output schema, the description adequately covers parameters, usage context, analyzed aspects, and return type. It doesn't provide a detailed breakdown of the returned style object, but that's not critical for invocation. The note about sibling tools adds completeness.

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%, with both parameters (from_file and grammar_content) having descriptions in the schema. The description adds an example usage for from_file but doesn't significantly expand on parameter semantics beyond what the schema provides. Baseline 3 is appropriate.

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 analyzes an ANTLR4 grammar and infers its formatting style. It specifies the resource (grammar) and the action (infer formatting), and lists the specific formatting aspects analyzed, distinguishing it from siblings like format-grammar or check-style.

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 provides an explicit 'When to use' section: understand formatting conventions or verify preservation. It also notes that update-rule and add-rule tools automatically use this inference, giving context on related tool behavior. It doesn't explicitly state when not to use, but the guidance 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