ANTLR4 MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ANTLR4 MCP Serverfind quantifier bugs in interface.g4"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ANTLR4 MCP Server
Grammar debugging and manipulation toolkit for Claude Desktop
An MCP (Model Context Protocol) server that gives Claude AI the ability to read, analyze, modify, and debug ANTLR4 grammars. Perfect for working with complex parsers, fixing grammar issues, and understanding large multi-file grammars.
What is this?
This tool lets Claude AI help you with ANTLR4 grammars by providing 55+ specialized tools. Instead of manually editing grammar files and running the ANTLR compiler repeatedly, Claude can:
Find bugs in your grammar (like using
?when you need*)Understand structure across multiple imported grammar files
Suggest fixes with context-aware token patterns
Make precise edits with diff output showing only changes
Aggregate warnings - Turn 17,000 warnings into 10 actionable items
Related MCP server: vscode-mcp
Why use this?
Traditional ANTLR workflow:
Edit grammar file
Run ANTLR compiler
See 17,000 warnings
Grep through them manually
Guess which ones matter
Repeat
With this tool + Claude:
Ask Claude "What's wrong with my grammar?"
Claude analyzes and says "You have 9 missing tokens and 8 quantifier bugs"
Claude shows you exactly which rules need
*instead of?Claude can fix them all at once or let you pick specific ones
Done in 30 minutes instead of hours
Features
55+ specialized grammar tools for analysis, validation, and modification
Smart validation - Aggregates 17,000+ warnings into 10 actionable items
Multi-file grammar support - Load and analyze imported grammars
Pattern detection - Finds suspicious quantifiers and anti-patterns
Performance analysis - Detect bottlenecks, benchmark parsing speed
Lexer mode support - Analyze and manage context-sensitive tokenization
Selective bulk fixes - Fix specific rules or all detected issues
Context-aware suggestions - Smart token pattern recommendations
Output limiting - Handle large grammars without token overflow
Diff mode - See only changes, not full files
Installation
Prerequisites
Node.js 18+ and npm
Claude Desktop or any MCP-compatible client
Optional: Java + ANTLR4 for native runtime (100% accurate parsing)
Setup
Clone and build:
git clone https://github.com/natl-set/antlr4-mcp.git
cd antlr4-mcp
npm install
npm run buildConfigure Claude Desktop:
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"antlr4": {
"command": "node",
"args": ["/path/to/antlr4-mcp/dist/index.js"]
}
}
}Restart Claude Desktop
Quick Start
Example 1: Validate a Large Grammar
// Old way: 17,234 individual warnings
await use_mcp_tool("antlr4", "validate-grammar", {
from_file: "MyGrammar.g4",
max_issues: 100
});
// New way: Smart validation
await use_mcp_tool("antlr4", "smart-validate", {
from_file: "MyGrammar.g4",
load_imports: true
});
// Output:
// 📊 Total: 17,234 issues across 3 categories
// 1. Undefined tokens (15,890 refs, 9 unique)
// → Add ADDRESS_REGEX (89 refs), EVENT_TYPE (67 refs)
// 2. Suspicious quantifiers (8 rules)
// → bgpp_export: rule? should be rule*
// 3. Incomplete parsing (3 rules)
// → ss_ssl_tls_service_profile uses null_rest_of_lineExample 2: Find and Fix Quantifier Issues
// Step 1: Detect issues
await use_mcp_tool("antlr4", "detect-quantifier-issues", {
from_file: "PaloAlto_interface.g4"
});
// Output shows:
// ⚠️ snie_ethernet (line 45)
// Pattern: )?
// Suggestion: Change to )* for multiple occurrences
//
// ⚠️ snie_lacp (line 62)
// Pattern: )?
// Suggestion: Change to )* for multiple occurrences
//
// ... (15 total issues)
// Step 2: Fix specific rules you want to change
await use_mcp_tool("antlr4", "fix-quantifier-issues", {
from_file: "PaloAlto_interface.g4",
rule_names: ["snie_ethernet", "snie_lacp", "snil_units"],
output_mode: "diff",
write_to_file: true
});
// Shows diff:
// @@ -49,7 +49,7 @@
// | snie_layer2
// | snie_layer3
// | snie_virtual_wire
// - )?
// + )*
// ;
// Or fix all detected issues at once:
await use_mcp_tool("antlr4", "fix-quantifier-issues", {
from_file: "PaloAlto_interface.g4",
write_to_file: true // Omit rule_names to fix all
});Example 3: Add and Test a Token
// Add token with diff output (see only changes)
await use_mcp_tool("antlr4", "add-rule", {
from_file: "MyGrammar.g4",
rule_name: "EQUALS",
pattern: "'='",
output_mode: "diff",
write_to_file: true
});
// Test it
await use_mcp_tool("antlr4", "preview-tokens", {
from_file: "MyGrammar.g4",
input: "x = 42"
});Key Tools
Smart Validation
smart-validate - Comprehensive analysis with aggregation
detect-quantifier-issues - Find
?that should be*detect-incomplete-parsing - Find anti-patterns
Analysis & Validation
analyze-grammar - Structure analysis with
summary_onlyoptionvalidate-grammar - Syntax validation with
max_issueslimitfind-rule-usages - Multi-file usage tracking
Grammar Manipulation
add-rule - Auto-detects lexer/parser from naming
update-rule - Modify existing rules
remove-rule - Delete rules safely
rename-rule - Rename with reference updates
move-rule - Reposition rules
sort-rules - Alphabetical sorting
inline-rule - Inline single-use rules
Testing & Preview
test-parser-rule - Test parser rules with inputs
preview-tokens - See tokenization results
test-lexer-rule - Test lexer patterns
Performance Analysis
analyze-bottlenecks - Detect high-branching rules, tilde negation, missing modes
benchmark-parsing - Simulated benchmark (quick estimate)
native-benchmark - Real ANTLR4 Java runtime benchmark (accurate)
profile-parsing - Detailed parse metrics (ambiguities, tree depth, rule frequency)
visualize-parse-tree - ASCII/JSON/LISP tree visualization
generate-stress-test - Generate stress test inputs for performance testing
compare-profiles - Compare two parsing profiles to measure optimization impact
compare-grammars - Compare two grammars to identify differences
Phase 1 Analysis
grammar-metrics - Branching estimation, complexity, dependencies
detect-redos - ReDoS vulnerability scanner
check-style - Style checker with quality scoring
Lexer Modes
analyze-lexer-modes - Analyze mode structure and rules
analyze-mode-transitions - Detect mode transition issues
add-lexer-mode - Add new lexer mode declaration
add-rule-to-mode - Add rule to specific mode
Bulk Operations
batch-create-tokens - Generate multiple tokens
suggest-tokens-from-errors - Parse error logs
Real-World Impact
Tested on Palo Alto firewall configuration grammar (36 files, 1500+ lines):
Before smart validation:
17,234 individual warnings
Hours of manual grep/analysis
Hard to identify root causes
After smart validation:
3 issue categories
9 missing tokens (with suggested patterns)
8 quantifier bugs (with specific fixes)
3 incomplete parsing patterns
Fixed in 30 minutes
Bugs Found
Quantifier bugs (8 rules)
bgpp_export: rule? // Should be rule*Impact: 1,200+ warnings
Missing tokens (9 tokens)
ADDRESS_REGEX, EVENT_TYPE, USERNAME_REGEX, ...Impact: 15,890 warnings
Incomplete parsing (3 rules)
rule: ... null_rest_of_line // Discards contentImpact: 144 warnings
Documentation
Features Overview - All 55+ tools explained
Smart Validation Guide - Complete guide with examples
Tool Specifications - Detailed specs for key features
Development
Build
npm run buildCLI Benchmarking
For accurate performance testing with the real ANTLR4 runtime:
# Download ANTLR4 (first time only)
mkdir -p ~/.local/lib
curl -L -o ~/.local/lib/antlr-4.13.1-complete.jar https://www.antlr.org/download/antlr-4.13.1-complete.jar
# Run benchmark
./benchmark-antlr4.sh MyGrammar.g4 start_rule test_input.txt 20Run Tests
cd tests
bash run-all-tests.shTest Suites
Data loss prevention
Output limiting
Diff output mode
Smart validation
Timeout prevention
All tests passing ✅
Architecture
src/index.ts - MCP server implementation
src/antlrAnalyzer.ts - Core grammar analysis engine
src/antlr4Runtime.ts - Native ANTLR4 runtime integration
Contributing
Issues and pull requests welcome at github.com/natl-set/antlr4-mcp
License
MIT
Credits
Built with the Model Context Protocol (MCP) by Anthropic.
Available Tools
55 toolsadd-lexer-modeA
Add a new lexer mode declaration to an ANTLR4 grammar.
When to use: Creating new modes for context-sensitive tokenization.
Features:
Adds "mode MODE_NAME;" declaration
Optional positioning with insert_after
Validates mode name format
Prevents duplicate mode names
Example - Add mode after specific rule: mode_name: "STRING_MODE" insert_after: "STRING" write_to_file: true
Example - Add mode at end of grammar: mode_name: "TEMPLATE_MODE" write_to_file: true
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| mode_name | Yes | Name of the new mode (UPPER_CASE recommended) | |
| output_mode | No | Output format: "full", "diff", or "none" | |
| insert_after | No | Optional: Insert mode declaration after this rule name | |
| write_to_file | No | If true, writes modified grammar back to from_file | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full behavioral burden. It discloses useful details like validation of mode name format and prevention of duplicate mode names. However, it omits potential side effects (e.g., file overwriting, permissions) and error behaviors, which are important 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.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with 'When to use', 'Features', and 'Example' sections. It is front-loaded with the main purpose and remains reasonably sized. The examples are useful but could be trimmed slightly without losing value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has 6 parameters and no output schema. The description explains the main use cases and features, but it does not clarify more complex aspects like the output_mode parameter (full/diff/none) or the exact relationship between from_file and grammar_content. For a moderately complex tool, this leaves some gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds examples and mentions optional positioning, but it does not significantly enhance the existing parameter descriptions. The examples clarify parameter combinations but do not add new semantic meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description begins with a specific verb and resource: 'Add a new lexer mode declaration to an ANTLR4 grammar.' This clearly distinguishes it from sibling tools like add-rule or add-parser-rules, which operate on rules rather than mode declarations.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section explicitly states the intended context: 'Creating new modes for context-sensitive tokenization.' It provides clear guidance on when to invoke this tool, though it does not name alternative tools or explicit exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
add-lexer-rules-removedA
Add multiple lexer rules to a grammar in a single operation (bulk add).
When to use: Set up initial grammar structure, add multiple related tokens at once, or import rules from another grammar.
Example - Add common tokens: rules: [ { name: "ID", pattern: "[a-zA-Z_][a-zA-Z0-9_]" }, { name: "INT", pattern: "[0-9]+" }, { name: "WS", pattern: "[ \t\n\r]+", skip: true }, { name: "COMMENT", pattern: "//.?\n", channel: "COMMENTS" } ] 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
| Name | Required | Description | Default |
|---|---|---|---|
| rules | Yes | Array of lexer rules to add. Each rule requires name and pattern properties. | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| output_mode | No | Output mode: "full" returns complete grammar, "diff" returns git-style diff (default: diff), "none" returns no content | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does excellently: it discloses alphabetical insertion, duplicate prevention, partial success with per-rule reporting, atomic per-rule operations, and file write confirmation. This is exemplary 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.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with headers and bullets, and each section (summary, when-to-use, example, features, returns) earns its place. It's longer than minimal, but the extra length is used for genuinely useful detail like the example and return format.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 5 params and no output schema, the description covers return values (summary, per-rule results, modified grammar, file confirmation), key behaviors (partial success, duplicate prevention), and an illustrative example. This gives an agent everything needed to select and invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds a concrete example showing the rules array structure (name, pattern, skip, channel) and clarifies the relationship between from_file and write_to_file. This goes beyond the schema and earns a 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description starts with a clear verb-resource statement: 'Add multiple lexer rules to a grammar in a single operation (bulk add).' It explicitly specifies 'lexer' and 'multiple', which distinguishes it from single-rule tools like add-rule and parser-rule tools like add-parser-rules.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section gives three concrete scenarios: initial grammar structure, adding multiple related tokens, and importing rules. It doesn't explicitly name alternative tools or say when not to use this tool, but the context is clear enough for an agent to choose it appropriately for bulk lexer additions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
add-parser-rulesA
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
| Name | Required | Description | Default |
|---|---|---|---|
| rules | Yes | Array of parser rules to add. Each rule requires name and definition properties. | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
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.
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.
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.
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.
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.
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.
add-ruleA
Add a new lexer or parser rule with automatic type detection and positioning.
Auto-detection: Rule type is determined by naming convention:
UPPERCASE = lexer rule (e.g., ID, STRING, NUMBER)
lowercase = parser rule (e.g., expression, statement, term)
When to use: Add any rule to your grammar - lexer tokens or parser rules.
Example - Add lexer rule (UPPERCASE): rule_name: "ID" pattern: "[a-zA-Z_][a-zA-Z0-9_]*"
Example - Add parser rule (lowercase): rule_name: "expression" definition: "term ((PLUS | MINUS) term)*"
Example - Add lexer with skip: rule_name: "WS" pattern: "[ \t\n\r]+" skip: true
Example - Add lexer with channel: rule_name: "COMMENT" pattern: "//.*?\n" channel: "COMMENTS"
Example - Add fragment: rule_name: "DIGIT" pattern: "[0-9]" fragment: true
Example - Add with positioning: rule_name: "STRING" pattern: "".*?"" insert_after: "ID"
Example - Add parser with return type: rule_name: "intLiteral" definition: "INT" return_type: "int value"
Features:
Auto-detects lexer vs parser from rule name case
Default: Alphabetical sorting within rule type
Optional: Custom positioning with insert_after/insert_before
Lexer-specific: skip, channel, fragment options
Parser-specific: return_type option
Prevents duplicate rule names
Optional file persistence with write_to_file: true
Diff output mode for large grammars
Returns: Modified grammar with new rule inserted, success message, position description, file write confirmation if applicable.
| Name | Required | Description | Default |
|---|---|---|---|
| skip | No | Lexer only: If true, adds "-> skip" directive (common for whitespace) | |
| channel | No | Lexer only: Channel name to route tokens (e.g., "COMMENTS") | |
| pattern | No | For lexer rules: The lexer pattern. Examples: [0-9]+, \".*?\", [a-zA-Z_][a-zA-Z0-9_]* | |
| fragment | No | Lexer only: If true, marks rule as fragment (reusable pattern, not a token) | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| rule_name | Yes | Name of the rule. UPPERCASE for lexer rules (ID, STRING), lowercase for parser rules (expression, term) | |
| definition | No | For parser rules: The rule definition. Examples: "ID ASSIGN expr", "term (PLUS term)*" | |
| output_mode | No | Output format: "full" returns entire modified grammar, "diff" returns git-style unified diff (default for modification tools), "none" returns no content (useful for write-only operations) | |
| return_type | No | Parser only: Return type specification (e.g., "String value", "int result") | |
| insert_after | No | Optional: Insert this rule immediately after the specified rule name. Overrides alphabetical sorting. | |
| insert_before | No | Optional: Insert this rule immediately before the specified rule name. Overrides alphabetical sorting. | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden and excels: it discloses automatic type detection, default alphabetical sorting, custom positioning with insert_after/insert_before, duplicate prevention, optional file persistence, diff output mode, and return behavior. This goes far beyond a generic action statement.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a core summary, examples, and feature list. However, the Features section partially repeats the examples and the examples are numerous, making it longer than strictly necessary. Still, the content is valuable and front-loaded with the primary purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 13-parameter tool with no output schema, the description is remarkably complete: it covers return values, output modes, all parameter categories, file persistence, and provides a variety of examples covering lexer, parser, fragment, skip, channel, positioning, and return types. It leaves no major ambiguity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Although schema coverage is 100%, the description adds substantial practical meaning by explaining naming conventions for rule_name, giving per-parameter examples (skip, channel, fragment, return_type, positioning), and illustrating lexer vs parser usage. This transforms abstract schema fields into actionable guidance.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Add a new lexer or parser rule with automatic type detection and positioning.' The verb 'Add' plus resource 'lexer or parser rule' makes purpose explicit, and the auto-detection and positioning details distinguish it from specialized siblings like add-parser-rules and add-rule-to-mode.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Includes an explicit 'When to use' section: 'Add any rule to your grammar - lexer tokens or parser rules.' This provides clear context but does not mention alternatives or cases where specialized tools like add-parser-rules should be preferred, so it lacks explicit when-not guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
add-rulesA
Add multiple mixed parser and lexer rules in a single operation (bulk add).
When to use: Set up complete grammar structure, add both tokens and parsing rules together, or quickly prototype.
Example - Add mixed rules: rules: [ { type: "lexer", name: "PLUS", pattern: "'+'" }, { type: "lexer", name: "MINUS", pattern: "'-'" }, { type: "parser", name: "expression", definition: "term ((PLUS | MINUS) term)*" }, { type: "parser", name: "term", definition: "INT | ID" } ] write_to_file: true
Features:
Handles both lexer and parser rules in one operation
Rules sorted alphabetically within their type category
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
| Name | Required | Description | Default |
|---|---|---|---|
| rules | Yes | Array of mixed rules to add. Each rule requires type and name. Lexer rules need pattern, parser rules need definition. | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description fully discloses key behaviors: alphabetical sorting, duplicate prevention, partial success, atomic per-rule operations, and per-rule reporting. Also explains return values and file write behavior, exceeding what annotations would typically convey.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections for when to use, an example, features, and returns. Although lengthy, every sentence contributes value and there is no redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex bulk operation with mixed rule types and partial success, the description covers usage context, behavioral details, return format, and a concrete example. Without an output schema, it still explains what the caller receives, making the description complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Since schema description coverage is 100%, the schema already documents all parameters. The description adds an example demonstrating the rules array structure, but no additional parameter semantics beyond what the schema provides, so the baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States clearly that it adds multiple mixed lexer and parser rules in a single operation, distinguishing it from singular add-rule sibling. The verb 'Add' and resource 'multiple mixed parser and lexer rules' are specific and unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit 'When to use' scenarios such as setting up complete grammar structure or prototyping, but does not explicitly name alternatives or state when not to use the tool. Clear context without exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
add-rule-to-modeA
Add a lexer rule to a specific mode in an ANTLR4 grammar.
When to use: Adding tokens that only apply in specific lexical contexts.
Features:
Places rule in the correct mode section
Validates mode exists
Supports all lexer rule options (skip, channel, fragment)
Auto-sorts within the mode
Example - Add rule to STRING_MODE: rule_name: "INTERPOLATION_START" pattern: "\{" mode_name: "STRING_MODE" write_to_file: true
Example - Add with pushMode action: rule_name: "INTERPOLATION_START" pattern: "\{" mode_name: "STRING_MODE" action: "pushMode(EXPRESSION_MODE)" write_to_file: true
| Name | Required | Description | Default |
|---|---|---|---|
| skip | No | If true, adds "-> skip" directive | |
| action | No | Lexer action (e.g., "pushMode(MODE)", "popMode", "type(TYPE)") | |
| channel | No | Channel name to route tokens | |
| pattern | Yes | The lexer pattern | |
| fragment | No | If true, marks rule as fragment | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| mode_name | Yes | Name of the mode to add the rule to | |
| rule_name | Yes | Name of the lexer rule (UPPER_CASE) | |
| output_mode | No | Output format: "full", "diff", or "none" | |
| write_to_file | No | If true, writes modified grammar back to from_file | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses useful behaviors: places rule in correct mode, validates mode exists, supports all lexer rule options, and auto-sorts within the mode. It also shows example usages with action. It does not mention potential error behavior or return format, but the key behavioral traits are covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a clear opening statement, a 'When to use' section, a bulleted feature list, and two illustrative examples. It is not overly verbose, and the front-loaded purpose makes it easy to grasp quickly. The examples add useful detail but could be seen as slightly redundant.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of the tool (11 parameters, no annotations, no output schema), the description does a good job of covering the essential usage context. It explains what the tool does, when to use it, and provides examples. It doesn't fully explain edge cases like the relationship between from_file and grammar_content, or the meaning of output_mode, but the schema covers these and the description is reasonably complete for practical use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already provides 100% coverage of parameter descriptions, so the baseline is 3. The description adds value by providing concrete examples that show how rule_name, pattern, mode_name, action, and write_to_file are used together. This clarifies the intended semantics beyond individual schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Add a lexer rule to a specific mode in an ANTLR4 grammar.' It uses a specific verb (add) and resource (lexer rule to a mode), and this distinguishes it from siblings like add-rule (general) and move-rule-to-mode (moving existing rules).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a 'When to use' section: 'Adding tokens that only apply in specific lexical contexts.' This gives clear guidance on when this tool is appropriate, and the examples illustrate usage. It doesn't explicitly state when not to use it or mention alternatives, but the context strongly implies it's for mode-specific rules rather than global rules.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
add-tokens-with-templateA
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
| Name | Required | Description | Default |
|---|---|---|---|
| skip | No | If true, adds "-> skip" directive to all generated tokens | |
| channel | No | Optional: Channel name for all generated tokens | |
| pattern | No | Optional: Custom pattern template. Use {NAME} as placeholder for base name. Default: '{NAME}' | |
| fragment | No | If true, marks all generated tokens as fragments | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| base_names | Yes | Base names for tokens (e.g., ["ftm-push", "dns", "firewall"]) | |
| write_to_file | No | If true, writes modified grammar back to from_file | |
| grammar_content | No | The ANTLR4 grammar file content | |
| preceding_tokens | No | Optional: Tokens that precede these (for documentation purposes) |
TDQS
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.
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.
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.
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.
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.
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.
analyze-ambiguitiesA
Analyze grammar for common ambiguity patterns that may cause conflicts at runtime.
When to use: Before compiling grammar, after making changes, or when diagnosing parser warnings.
Detection Capabilities:
Identical Alternatives (ERROR)
Detects exact duplicate alternatives in rules
Example:
expr: ID | NUMBER | ID→ duplicate ID alternative
Overlapping Prefixes (WARNING)
Finds alternatives that start with same tokens
Example:
stmt: IF expr THEN stmt | IF expr THEN stmt ELSE stmtSuggestion: Factor out common prefix
Ambiguous Optionals (WARNING)
Detects
A? Apatterns (should beA+)Detects
A? A*patterns (A* is sufficient)
Hidden Left Recursion (ERROR)
Detects indirect left recursion via other rules
Example:
expr: term,term: expr PLUS→ hidden recursion
Lexer Conflicts (WARNING)
Identifies lexer rules that may overlap
Example:
ID: [a-z]+andKEYWORD: 'if'→ keyword is also valid ID
Options:
Selective checks: Enable/disable specific ambiguity patterns
Minimum prefix length: Set threshold for prefix overlap warnings
Severity levels: ERROR (must fix), WARNING (should review), INFO (optional)
Returns:
List of issues with severity, type, rule name, line number
Detailed descriptions and actionable suggestions
Summary counts (errors, warnings, infos)
Example usage: from_file: "MyGrammar.g4" checkIdenticalAlternatives: true checkOverlappingPrefixes: true minPrefixLength: 2
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content | |
| minPrefixLength | No | Minimum prefix length for overlap warnings (default: 2) | |
| checkLeftRecursion | No | Check for hidden left recursion (default: true) | |
| checkLexerConflicts | No | Check for lexer rule conflicts (default: true) | |
| checkAmbiguousOptionals | No | Check for ambiguous optional patterns like A? A (default: true) | |
| checkOverlappingPrefixes | No | Check for alternatives with common prefixes (default: true) | |
| checkIdenticalAlternatives | No | Check for duplicate alternatives (default: true) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden, and it does well: it details detection capabilities by severity (ERROR vs WARNING), lists return contents (issues with severity, type, rule name, line number), and mentions suggestions and summary counts. It doesn't explicitly state that the tool is read-only or describe side effects, but its 'Analyze' and 'Detects' phrasing implies non-mutating behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is lengthy but well-structured with clear headers, numbered detection capabilities, options, returns, and an example. Every section adds necessary information and directly supports tool usage. It is front-loaded with purpose and when-to-use, ensuring the most critical details are immediately visible.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (8 params, no output schema, no annotations), the description is remarkably complete. It covers purpose, use cases, detection patterns, configurable options, return values, and an example invocation. It doesn't leave major gaps for the agent to infer, and the lack of an output schema is mitigated by a textual description of the return structure.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Even though schema coverage is 100% with parameter descriptions, the description adds significant semantic value. For example, it explains what each check does (e.g., 'Identical Alternatives' detects duplicate alternatives) and clarifies 'minPrefixLength' as a threshold. The example usage reinforces parameter names and default behaviors, going beyond the schema's one-line descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific action: 'Analyze grammar for common ambiguity patterns that may cause conflicts at runtime.' This sets it apart from sibling tools like analyze-grammar (general analysis) and validate-grammar (validation). The scope is precise, focusing on ambiguity detection.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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: 'Before compiling grammar, after making changes, or when diagnosing parser warnings.' This gives clear usage context. However, it does not explicitly mention when not to use it or direct users to alternative tools (e.g., detect-redos for regex-specific issues), so it falls short of a perfect 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
analyze-bottlenecksA
Analyze grammar for performance bottlenecks and optimization opportunities.
When to use: Performance optimization, grammar refactoring, large grammar analysis.
Detects:
High-branching rules: Rules with many alternatives (10+, 20+, 50+)
Tilde negation patterns: ~NEWLINE, ~[ ] that could use lexer modes
Missing lexer mode opportunities: String handling, line-based content, multi-line blocks
Greedy loop issues: Nested quantifiers, reluctant patterns
Deep recursion: Rules with potential stack overflow risk
Token prefix collisions: Keywords that are prefixes of other keywords
Returns:
Bottlenecks with severity (high/medium/low)
Specific suggestions for each issue
Estimated performance improvement potential
Prioritized recommendations
Example: from_file: "MyGrammar.g4"
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It delivers by enumerating six specific detection categories (high-branching rules, tilde negation, lexer mode opportunities, greedy loops, deep recursion, token prefix collisions) and four return elements including severity levels. It lacks side-effect/permission details, but these are largely irrelevant for a read-only analysis tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Well-structured markdown with clear sections (purpose, when to use, detects, returns, example). The key purpose is front-loaded in the first sentence, and each bullet list provides specific, actionable detail without redundancy or filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the full context: what it does, when to use it, what issues it detects, what it returns (important given the absence of an output schema), and how to invoke it with an example. Minor gap: since both parameters are optional, it is unclear how the tool obtains the grammar when neither is provided.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% — both parameters are fully described in the schema — so the baseline is 3. The description adds only an example showing from_file usage ('from_file: "MyGrammar.g4"'), which marginally demonstrates invocation format but adds no semantic meaning beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The first sentence states a specific action ('Analyze grammar') with a clear scope ('performance bottlenecks and optimization opportunities'). This clearly distinguishes it from sibling tools like analyze-ambiguities, analyze-lexer-modes, and detect-redos, which target different aspects of grammar analysis.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description includes an explicit 'When to use' section naming three use cases: performance optimization, grammar refactoring, and large grammar analysis. However, it does not name alternative tools or state when not to use it, so it falls short of the 'explicit when/when-not/alternatives' bar.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
analyze-grammarA
Analyze an ANTLR4 grammar file and extract its complete structure.
When to use: First step when exploring an unfamiliar grammar, understanding architecture, or extracting metadata.
Multi-file support: Set load_imports=true to automatically resolve and analyze imported grammars.
Example usage: from_file: "examples/MyGrammar.g4"
Multi-file example: from_file: "PaloAlto_rulebase.g4" base_path: "/path/to/grammars" load_imports: true
Returns:
Grammar name and type (parser/lexer/combined)
All parser rules with definitions and line numbers
All lexer rules with patterns
Rule references and dependencies (which rules reference which)
Import declarations
Grammar options
Validation issues (undefined rules, unused rules, recursion)
With load_imports=true: Includes rules from all imported grammars
| Name | Required | Description | Default |
|---|---|---|---|
| base_path | No | Optional: base directory for resolving imports. Defaults to directory of from_file. | |
| from_file | No | Optional: path to a grammar file to read (overrides grammar_content). Recommended for file-based workflows. | |
| load_imports | No | Optional: if true, automatically load and merge imported grammars. Default: true. | |
| summary_only | No | Optional: if true, returns only summary statistics without full rule details. Default: false. Use this for large multi-file grammars. | |
| grammar_content | No | The content of the ANTLR4 grammar file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Since annotations are not provided, the description carries the full burden of behavioral transparency. It details the return types such as 'All parser rules with definitions and line numbers' and 'Validation issues,' and explicitly describes the effect of load_imports on merging rules. It does not mention any side effects or error behavior, but for a read-only analysis tool this is sufficient – no contradictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is structured in sections (goal, when to use, multi-file support, examples, returns) and is front-loaded with the core purpose. It is somewhat lengthy but each section contains useful information; the returns list is particularly informative. It earns a 4 rather than 5 because it could be tightened without losing meaning.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the description compensates by enumerating the categories of results (grammar name/type, parser rules, lexer rules, references, imports, options, validation issues) and noting behavioral flags like load_imports. It also provides concrete example usage for file-based and multi-file workflows. However, it does not specify the exact output structure (e.g., field names), leaving some ambiguity for the agent, so a 4 is appropriate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with all five parameters already documented in the schema. The description adds an example of using from_file and base_path together and notes that load_imports=true resolves imported grammars, but this does not go beyond the schema's explanation of 'automatically load and merge imported grammars.' Thus it provides only marginal additional value.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it 'Analyze an ANTLR4 grammar file and extract its complete structure,' using a specific verb and resource. It further distinguishes itself as the 'First step when exploring an unfamiliar grammar,' which sets it apart from siblings like list-rules or validate-grammar by emphasizing complete structural extraction.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section explicitly positions this as the first step for exploring unfamiliar grammars, understanding architecture, or extracting metadata. However, it does not name specific alternative tools or exclusion conditions, so it lacks explicit when-not-to-use guidance, making it clear context but no exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
analyze-lexer-modesA
Analyze lexer mode structure in ANTLR4 grammars.
When to use: Understanding mode-based tokenization, debugging mode transitions, documenting mode structure.
Lexer modes allow context-sensitive tokenization by switching between different sets of lexer rules. Common use cases:
String interpolation (switching modes inside strings)
Nested comments
Template parsing
Context-specific keywords
Features:
Lists all defined modes with their rules
Identifies mode entry points (pushMode actions)
Identifies mode exit points (popMode actions)
Detects common issues (undefined modes, unreachable modes, popMode in DEFAULT_MODE)
Returns:
modes: List of modes with their rules and line numbers
entryPoints: Rules that push to each mode
exitPoints: Rules that pop from each mode
issues: Problems detected (undefined modes, empty modes, etc.)
Example usage: from_file: "MyLexer.g4"
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the transparency burden. It describes what the tool does (lists, identifies, detects) and its return structure, but it does not explicitly state that it is read-only or mention any side effects, limitations, or error behavior. This is a partial disclosure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with headers and bullet points, and the main purpose is front-loaded. However, it includes a lengthy background explanation of lexer modes that is not strictly necessary for using the tool. It could be tightened without losing value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the 'Returns' section is helpful and describes the main output fields. However, it does not cover edge cases like invalid grammar input, missing parameters, or how the tool behaves when both from_file and grammar_content are used. The description is adequate but not fully complete for all usage scenarios.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% since both parameters have descriptions. The description adds an example usage for from_file but does not clarify the relationship or precedence between the two parameters (e.g., which is used if both are supplied, or what happens if neither is provided). This leaves some ambiguity beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a clear, specific statement: 'Analyze lexer mode structure in ANTLR4 grammars.' It distinguishes itself from siblings by listing features (lists all modes, entry/exit points, detects issues) that go beyond what analyze-mode-transitions or list-mode-rules might offer.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides an explicit 'When to use' section with concrete scenarios: understanding mode-based tokenization, debugging mode transitions, documenting mode structure. It does not explicitly compare to alternative tools or state when not to use, but the context is clear enough.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
analyze-mode-transitionsA
Analyze mode transition graph and detect issues in ANTLR4 lexer modes.
When to use: Debugging mode switching logic, ensuring balanced push/pop, detecting circular transitions.
Features:
Builds complete mode transition graph
Detects circular mode transitions
Checks for balanced pushMode/popMode usage
Identifies modes with no exit points
Suggests improvements for mode structure
Returns:
transitions: List of all mode transitions (from, to, via action, rule)
issues: Problems detected (circular transitions, unbalanced push/pop)
suggestions: Recommendations for improving mode structure
Example usage: from_file: "MyLexer.g4"
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Since no annotations are provided, the description carries the full burden. It discloses the tool's analysis behavior in detail: builds a complete transition graph, detects circular transitions, checks balanced push/pop, identifies modes without exit points, and suggests improvements. It also clearly describes the return structure, making the tool's behavior transparent. However, it doesn't explicitly state that it is read-only (non-destructive), though this is implied by its analytical nature.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with clear sections: purpose, when-to-use, features, returns, and example. Every sentence contributes meaningful information, and the bulleted features improve scannability without unnecessary verbosity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description fully covers the tool's context: it explains what it does, when to use it, its key features, the structure of its return values (transitions, issues, suggestions), and provides a usage example. With no output schema present, the description adequately compensates by detailing the return fields. No important aspects appear missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already provides 100% coverage, with both parameters (from_file and grammar_content) having descriptions. The tool description adds an example usage with from_file, but does not introduce new semantic meaning beyond the schema. Thus, the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Analyze') and resource ('mode transition graph'), and further specifies it detects issues in ANTLR4 lexer modes. This distinguishes it from siblings like analyze-grammar or list-mode-rules, and the 'When to use' section reinforces the specific function.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section explicitly lists concrete use cases: debugging mode switching logic, ensuring balanced push/pop, detecting circular transitions. This provides clear context for when this tool is appropriate, though it does not explicitly mention alternatives or when-not-to-use, which would elevate it to a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
benchmark-parsingA
Benchmark grammar parsing performance with sample input.
When to use: Performance testing, comparing grammar versions, optimization validation.
Measures:
Total tokens produced
Average/min/max parse time (ms)
Tokens per second throughput
Performance rating (excellent/good/fair/slow)
Features:
Warmup iterations to account for JIT
Multiple iterations for statistical accuracy
Performance rating based on parse time
Optimization suggestions for slow grammars
Parameters:
grammar_content or from_file: The grammar to test
input: Sample input text to parse
iterations: Number of timed iterations (default: 10)
warmup_iterations: Warmup runs before timing (default: 3)
Example: from_file: "MyGrammar.g4" input: "x = 42 + y * 10" iterations: 20
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Sample input text to parse | |
| from_file | No | Optional: path to a grammar file to read | |
| iterations | No | Number of timed iterations (default: 10) | |
| grammar_content | No | The ANTLR4 grammar file content | |
| warmup_iterations | No | Warmup runs before timing (default: 3) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does so thoroughly. It discloses warmup iterations for JIT, multiple iterations for statistical accuracy, a performance rating framework, and optimization suggestions—giving the agent a comprehensive behavioral model.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with sections for when-to-use, measures, features, parameters, and an example. Every section earns its place, and the format makes it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Without an output schema, the 'Measures' section clearly explains expected return values (tokens, parse times, throughput, rating). The features and example make this a complete standalone description for a complex benchmarking tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, but the description adds meaningful relationships: it clarifies that grammar_content and from_file are alternatives, and provides a concrete example combining from_file with input. This goes beyond the schema's flat property list.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb+resource: 'Benchmark grammar parsing performance with sample input.' This clearly distinguishes the tool from siblings like compare-grammars or native-benchmark, and the 'Measures' section further clarifies its scope.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section explicitly lists performance testing, grammar version comparison, and optimization validation. It provides clear usage context but does not explicitly exclude overlapping tools like profile-parsing or analyze-bottlenecks, so it stops short of a full 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
check-styleA
Check grammar style and best practices with quality scoring.
When to use: Code review, maintaining grammar quality, enforcing conventions.
Checks:
Naming Conventions:
Lexer rules should use UPPER_CASE
Parser rules should use lowerCamelCase
Best Practices:
Missing grammar declaration
Unused/orphan rules
Overly complex rules
Maintainability:
Missing documentation on complex rules
Rule complexity warnings
Returns:
Issues with severity (error/warning/info)
Style score (0-100)
Specific suggestions for each issue
Example: from_file: "MyGrammar.g4"
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full transparency burden. It discloses the types of checks performed, the return structure (issues with severity, score, suggestions), and provides an example. It does not explicitly state it is read-only, but the nature of 'check-style' implies no side effects. The description gives sufficient insight into behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections (When to use, Checks, Returns, Example) and bullet-pointed check items. It is concise, front-loaded with the core purpose, and every sentence adds value without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description provides a comprehensive overview: purpose, when to use, what checks are performed, what is returned, and an example. There is no output schema, so the description appropriately explains return values. It could mention that grammar can also be provided via grammar_content, but the schema covers that, so the description remains complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description covers both parameters (from_file and grammar_content) at 100%, so the schema already documents them. The description adds an example using from_file, which is helpful, but it does not explain when to use one parameter over the other. Since schema coverage is high, a baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Check grammar style and best practices with quality scoring', which uses a specific verb (check) and resource (grammar style and best practices) and distinguishes it from sibling tools. It also lists concrete checks (naming conventions, best practices, maintainability) that further clarify its unique role.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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 clear contexts: 'Code review, maintaining grammar quality, enforcing conventions.' However, it does not explicitly mention alternatives or when not to use this tool, so it lacks exclusions and direct sibling comparisons.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
compare-grammarsA
Compare two ANTLR4 grammars side-by-side to identify differences.
When to use: Understand changes between versions, merge grammars, or analyze variations.
Example usage: from_file1: "v1/MyGrammar.g4" from_file2: "v2/MyGrammar.g4"
Returns:
Common rules (unchanged)
Rules unique to grammar 1
Rules unique to grammar 2
Modified rules (exist in both but differ)
Statistical summary (counts, percentages)
| Name | Required | Description | Default |
|---|---|---|---|
| from_file1 | No | Path to first grammar file (overrides grammar1_content) | |
| from_file2 | No | Path to second grammar file (overrides grammar2_content) | |
| grammar1_content | No | Content of the first grammar file (required if from_file1 not provided) | |
| grammar2_content | No | Content of the second grammar file (required if from_file2 not provided) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the full burden. It clearly discloses the output behavior by listing the returned categories (common, unique, modified rules, statistical summary) and implies a read-only operation through the verb 'compare.' It does not mention potential error conditions or side effects, but for a comparison tool this is acceptable.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well structured with a clear first sentence, a 'When to use' section, an example, and a bulleted output list. It is slightly longer than necessary, but every section adds value and the information is easy to scan.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has four parameters with a logical mutual exclusivity (file path vs. content), but the description does not explicitly state that users must provide either from_file1/from_file2 or grammar1_content/grammar2_content. The output schema is absent, so the description's output list helps, but the missing requirement explanation leaves a notable gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema covers all four parameters descriptively (e.g., 'overrides grammar1_content'), so the baseline is 3. The description adds an example usage with actual file paths, which helps clarify parameter format, but it does not introduce new semantic details beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Compare two ANTLR4 grammars side-by-side to identify differences.' It uses a specific verb ('compare') and resource ('two ANTLR4 grammars'), which distinguishes it from sibling tools like compare-profiles, which compares profiles rather than grammars.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit use cases: 'Understand changes between versions, merge grammars, or analyze variations.' It also includes an example invocation. However, it does not explicitly mention alternatives or state when not to use this tool, so it falls short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
compare-profilesA
Compare two parsing profiles to measure optimization impact.
When to use: Validating grammar optimizations, A/B testing changes, regression testing.
Parameters:
profile1: First profile result (from profile-parsing)
profile2: Second profile result (from profile-parsing)
Returns:
Comparison metrics with % change
Performance verdict (improved, degraded, unchanged)
Key differences highlighted
Recommendations based on changes
Example: profile1: { parseTimeMs: 150, ambiguityCount: 5, ... } profile2: { parseTimeMs: 80, ambiguityCount: 0, ... }
Output:
Metric | Before | After | Change |
Parse Time | 150ms | 80ms | -46.7% ✅ |
Ambiguities | 5 | 0 | -100% ✅ |
Verdict: ✅ Improved - Parse time reduced by 46.7%
| Name | Required | Description | Default |
|---|---|---|---|
| profile1 | Yes | First profile result (baseline) | |
| profile2 | Yes | Second profile result (optimized) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full responsibility. It discloses return values (metrics, verdict, differences, recommendations) and provides a detailed example output, giving agents a clear behavioral picture. It doesn't mention error handling or assumptions, preventing a 5.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized into clear sections (purpose, when-to-use, parameters, returns, example). The example is illustrative but makes it somewhat long. Each section earns its place, though brevity could be improved.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given moderate complexity (two nested objects, no output schema), the description compensates well by listing return categories and giving a concrete example. It could be more exhaustive about edge cases but largely covers necessary context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema already covers both parameters (baseline/optimized) with descriptions, giving a baseline of 3. The tool description adds value by specifying the source (from profile-parsing) and showing a concrete example of how profiles are structured, pushing it to 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a clear action: 'Compare two parsing profiles to measure optimization impact.' This specific verb+resource phrase distinguishes it from siblings like compare-grammars and ties to the profile-parsing workflow.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
A dedicated 'When to use' section lists concrete scenarios: validating optimizations, A/B testing, and regression testing. However, it does not explicitly state when not to use it or name alternative tools, so it falls just short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
compile-grammarA
Run native ANTLR4 compilation checks for grammar syntax/tooling errors.
When to use: Before committing grammar edits, after refactors, or when validate-grammar looks clean but ANTLR toolchain still fails.
Supports:
ANTLR4 native diagnostics (error/warning with line/column)
Multi-file imports/tokenVocab with load_imports=true and from_file
Compile timing and generated file summary
Example usage: from_file: "MyGrammar.g4" load_imports: true
Returns: compile success/failure, native diagnostics, timing, generated artifacts.
| Name | Required | Description | Default |
|---|---|---|---|
| base_path | No | Optional: base directory for resolving imports/tokenVocab. Defaults to from_file directory. | |
| from_file | No | Optional: path to grammar file to compile (recommended for import-aware checks) | |
| load_imports | No | Optional: if true, loads imported grammars and tokenVocab grammars before compile. Default: true. | |
| grammar_content | No | The ANTLR4 grammar content (optional when from_file is provided) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry the full behavioral burden. It discloses the nature of diagnostics (error/warning with line/column), import/tokenVocab loading behavior, compile timing, and return contents. It does not explicitly state whether the operation is read-only, but 'checks' implies no mutation, so the transparency is strong.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a bold 'When to use' section, bulleted supports, an example, and a returns line. It is slightly verbose, but every section earns its place, and the key verb is front-loaded. Minor redundancy with schema details prevents a 5.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite no output schema and no annotations, the description covers the tool's purpose, usage guidance, supported features, an example, and explicit return values (success/failure, diagnostics, timing, generated artifacts). This is fully sufficient for an agent to select and invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds relational meaning by linking load_imports=true and from_file to multi-file imports/tokenVocab, and the example usage clarifies the recommended parameter combination. This goes beyond the raw schema definitions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with 'Run native ANTLR4 compilation checks for grammar syntax/tooling errors,' which uses a specific verb and resource. It distinguishes this tool from the sibling validate-grammar by emphasizing 'native' and 'tooling errors,' making the purpose clear and unique.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It includes an explicit 'When to use' section that names validate-grammar as an alternative and specifies the condition: 'when validate-grammar looks clean but ANTLR toolchain still fails.' This directly tells the agent when to prefer this tool over a sibling.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
create-grammar-templateA
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
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Type of grammar to create (default: lexer) | |
| modes | No | List of mode names to include in the grammar | |
| grammar_name | Yes | Name for the new grammar | |
| grammar_content | No | Placeholder - not required for this tool | |
| include_boilerplate | No | Include common rules like WS, ID, NUMBER, STRING (default: true) |
TDQS
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.
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.
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.
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.
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.
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.
detect-incomplete-parsingA
Detect incomplete parsing patterns (anti-patterns that discard content).
When to use: When grammar parses configs but doesn't capture structure, or uses placeholder patterns.
Anti-patterns detected:
null_rest_of_line usage → Discards content instead of parsing it → Example: ss_ssl_tls_service_profile: ... null_rest_of_line → Problem: Loses protocol-settings, certificates, etc.
Overly broad negation patterns → Example: rule: ~[\r\n]+ (matches "anything until newline") → Better: Define specific tokens for expected content
Real-world impact:
ss_ssl_tls_service_profile used null_rest_of_line
Lost: protocol-settings min-version/max-version, certificate options
Result: Thousands of warnings about unparsed structure
Recommendations:
Replace null_rest_of_line with actual structure
Define specific lexer tokens instead of broad negations
Implement proper parser rules for complex structures
Returns: List of incomplete parsing patterns with suggestions.
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavioral disclosure. It explains the anti-patterns detected, provides real-world impact, and states the return type ('List of incomplete parsing patterns with suggestions'). It does not mention side effects, permissions, or error behavior, but for a non-mutating analysis tool this is strong coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is structured with clear headings (when to use, anti-patterns, impact, recommendations) and front-loaded with the core purpose. It is longer than necessary but each section adds value, and the use of bullet points and examples improves readability.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has only two optional parameters and no output schema. The description provides enough context for usage: it explains what the tool does, when to use it, and what it returns. It could be slightly more detailed about return structure or edge cases, but for the tool's complexity it is sufficiently complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already describes both parameters ('from_file' and 'grammar_content') with 100% coverage. The description does not add new parameter-specific semantics beyond the schema, so the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Detect incomplete parsing patterns (anti-patterns that discard content).' It clearly distinguishes this from sibling tools like validate-grammar or detect-redos by focusing on anti-patterns that discard content, with concrete examples.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides a clear 'When to use' section stating it is for grammars that parse configs but don't capture structure, or use placeholder patterns. It gives clear context but does not explicitly name sibling tools as alternatives or state when not to use it, so it falls short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
detect-quantifier-issuesA
Detect suspicious quantifier patterns that may prevent parsing real configs.
When to use: After seeing "unrecognized syntax" warnings or when rules don't match multi-line configs.
Common patterns detected:
Rule names with _rule, _setting, _property using ? instead of * → bgpp_export: EXPORT bgp_policy_rule? should be *
Multiple optional elements that should be alternatives → source? destination? action? should be (source | destination | action)*
Same optional reference appearing multiple times → rule: setting? ... setting? should use setting*
Real-world example: Rule: srs_definition: ... source_setting? destination_setting? action_setting? Issue: Config has multiple 'set source', 'set destination' lines Fix: Change to (source_setting | destination_setting | action_setting)*
Returns: List of suspicious patterns with suggestions and reasoning.
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It discloses the return format ('List of suspicious patterns with suggestions and reasoning') and provides illustrative examples of detected patterns. It does not explicitly state whether it modifies the grammar, but given the verb 'detect' and the return description, the read-only nature is implied. It could benefit from a non-destructive statement but currently offers good transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is structured with clear sections (When to use, Common patterns detected, Real-world example, Returns). While it is longer than a typical two-sentence description, every section adds value by providing concrete examples and reasoning. The front-loaded purpose sentence is strong. It is well-organized and not unnecessarily verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema exists, but the description provides a clear return description. For a detection tool with two simple parameters, the description covers purpose, usage context, common patterns, an example, and return behavior. It lacks explicit edge-case or error-handling information, but given the tool's complexity, it is reasonably complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already provides descriptions for both parameters (from_file and grammar_content), achieving 100% coverage. The tool description does not add additional parameter semantics or mention how the parameters are used. According to the rubric, a baseline of 3 is appropriate when schema coverage is high and the description does not compensate further.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Detect suspicious quantifier patterns that may prevent parsing real configs.' It specifies a specific verb, resource, and scope, and distinguishes itself from sibling tools like fix-quantifier-issues by focusing on detection rather than fixing. The concrete patterns and examples reinforce a distinct purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description includes an explicit 'When to use' section ('After seeing "unrecognized syntax" warnings or when rules don't match multi-line configs'), providing clear context for usage. However, it does not explicitly mention alternatives or cases where this tool should not be used, such as referencing fix-quantifier-issues as the follow-up step.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
detect-redosA
Detect ReDoS (Regular Expression Denial of Service) vulnerabilities in lexer patterns.
When to use: Security audit, performance optimization, validating lexer patterns.
Detects:
Nested quantifiers: (a+)+, (a*)*
Overlapping alternatives: (a|a)+
Alternatives with common prefix: (ab|ac)
Unbounded repetition of broad character classes
Multiple optional elements in sequence
Returns:
List of vulnerabilities with severity (high/medium/low)
Line numbers and affected rules
Specific suggestions for each issue
Example: from_file: "MyLexer.g4"
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It clearly discloses what is detected and what is returned (list with severity, line numbers, suggestions). It does not explicitly state whether the tool is read-only or whether grammar must be valid, but the analysis nature implies no side effects. The detailed output description adds transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections: purpose, when to use, detections, returns, and an example. It is informative without being verbose, each sentence adds value, and it is front-loaded with the core purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (multiple detection patterns) and no output schema, the description adequately explains return values and usage context. It includes an example and covers when to use. It could be slightly improved by explicitly stating it works on ANTLR lexer grammars, but the .g4 example implies this.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so baseline is 3. The description provides a usage example with from_file, but does not elaborate on grammar_content beyond the schema. It adds marginal value with the example but does not significantly enhance parameter understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states 'Detect ReDoS vulnerabilities in lexer patterns' with a specific verb and resource. It lists concrete detection patterns (nested quantifiers, overlapping alternatives) and includes an example, distinguishing it from sibling analysis tools like validate-grammar or detect-quantifier-issues.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit 'When to use' with three scenarios: security audit, performance optimization, validating lexer patterns. However, it does not mention when not to use or explicitly compare to alternatives like detect-quantifier-issues, so it falls short of a full 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
duplicate-modeA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| new_mode | Yes | Name for the new mode | |
| from_file | No | Optional: path to a grammar file to read | |
| output_mode | No | Output format: "full", "diff", or "none" | |
| source_mode | Yes | Name of the mode to duplicate | |
| prefix_rules | No | Optional prefix for cloned rule names | |
| write_to_file | No | If true, writes modified grammar back to from_file | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
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.
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.
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.
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.
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.
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.
export-as-markdownA
Generate comprehensive Markdown documentation for your grammar.
When to use: Create README files, generate reference documentation, document grammar structure, share grammar specs.
Example usage: from_file: "MyGrammar.g4"
Generated documentation includes:
Grammar name, type, and metadata
Overview section with rule counts
Parser rules section with definitions and references
Lexer rules section with patterns
Import declarations
Grammar options
Validation issues and warnings
Summary statistics
Output format: Complete Markdown document ready for use in README.md or documentation sites.
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It describes the output format (complete Markdown document), enumerates the sections included (overview, parser rules, lexer rules, etc.), and provides an example usage. While it doesn't explicitly state side-effect-free behavior, the nature of 'generate' plus the focus on documentation implies a non-destructive operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with bolded sections and bullet lists, making it scannable. Every sentence adds value: purpose, when-to-use, example, output contents, and output format. It's appropriately sized for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description addresses the tool's purpose, usage context, example, output format, and the content included in the generated documentation. Since there is no output schema, this textual explanation adequately covers what the tool returns. It provides enough context for an agent to select and invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already provides descriptions for both parameters, giving 100% coverage, so the baseline is 3. The description adds a concrete example using 'from_file' but doesn't clarify the relationship between the two optional parameters or handling when both/neither are provided.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb ('Generate') and resource ('comprehensive Markdown documentation for your grammar'), clearly stating the tool's function. It distinguishes itself from sibling tools by focusing on Markdown export, while also listing explicit use cases like README creation and reference docs.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section explicitly lists four concrete scenarios: creating README files, generating reference documentation, documenting grammar structure, and sharing grammar specs. It provides clear context for when to choose this tool, though it doesn't name alternatives or state when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
extract-fragmentA
Extract a reusable fragment rule from a pattern to reduce duplication.
When to use: Share common patterns, improve maintainability, reduce duplication in lexer rules.
Example - Extract digit pattern: fragment_name: "DIGIT" pattern: "[0-9]"
Example - Extract letter pattern: fragment_name: "LETTER" pattern: "[a-zA-Z]"
After extraction, use the fragment in other rules: ID: LETTER (LETTER | DIGIT)*
Benefits:
Single source of truth for common patterns
Easier maintenance
Clearer lexer organization
Fragments are not tokens themselves (helper patterns only)
Returns: Modified grammar with fragment added, original pattern preserved in existing rules.
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | The pattern to extract as a fragment (e.g., "[0-9]", "[a-zA-Z]") | |
| from_file | No | Optional: path to a grammar file to read | |
| fragment_name | Yes | Name for the fragment (must be UPPERCASE, e.g., DIGIT, LETTER, IDENTIFIER_PART) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses key behavioral traits: the original pattern is preserved in existing rules, fragments are not tokens, and the return value is a modified grammar. It doesn't cover edge cases like duplicate fragment names or interaction between grammar_content and from_file, but overall it provides solid transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is structured with clear sections ('When to use', 'Example', 'Benefits', 'Returns') and is not excessively long. Each section contributes meaning, though the 'Benefits' bullet list could be condensed without losing much value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has a simple function (extract a fragment) and the description covers its use cases, examples, and return value. It doesn't mention potential parameter conflicts (e.g., providing both grammar_content and from_file), but given the simplicity and the existence of an output-free design, this is acceptable.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Although the input schema already has 100% coverage with descriptions, the tool description adds value by showing concrete examples of how fragment_name and pattern are used (DIGIT, LETTER) and demonstrating the resulting rule usage. This goes beyond the schema's basic parameter definitions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Extract a reusable fragment rule from a pattern') and resource (lexer fragments). It also differentiates from sibling tools by clarifying that fragments are helper patterns, not tokens, which distinguishes it from generic rule-addition tools like add-rule.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description includes an explicit 'When to use' section listing three concrete scenarios: share common patterns, improve maintainability, reduce duplication. However, it does not provide when-not-to-use guidance or explicitly name alternative tools, so it falls short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
find-ruleA
Find rules with multiple matching modes: exact, regex, wildcard, or partial matching.
When to use: Locate specific rules, understand rule relationships, or discover rules matching a pattern.
Matching Modes:
Exact (default) - Exact rule name match: rule_name: "expression"
Regex - Regular expression pattern: rule_name: "^[A-Z]+$" match_mode: "regex" (Finds all lexer rules)
Wildcard - Shell-style wildcards (* and ?): rule_name: "expr*" match_mode: "wildcard" (Finds expression, expr, exprStatement, etc.)
rule_name: "stat?" match_mode: "wildcard" (Finds stat1, stat2, stats, etc.)
Partial - Substring/contains search (case-insensitive): rule_name: "token" match_mode: "partial" (Finds tokenList, getToken, TOKEN_TYPE, etc.)
Examples:
All lexer rules: rule_name="^[A-Z]+$", match_mode="regex"
All parser rules: rule_name="^[a-z]+$", match_mode="regex"
Rules starting with "expr": rule_name="expr*", match_mode="wildcard"
Rules containing "statement": rule_name="statement", match_mode="partial"
Returns (exact match):
Rule definition, type, and line number
Referenced rules (fan-out: what this rule uses)
Referencing rules (fan-in: what uses this rule)
Usage count
Returns (pattern match):
All matching rules with their details
Match count
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| rule_name | Yes | Rule name or pattern. For wildcards: * matches any characters, ? matches single character. For regex: use standard regex syntax. | |
| use_regex | No | DEPRECATED: Use match_mode="regex" instead. If true, treats rule_name as regex pattern. | |
| match_mode | No | Matching mode: "exact" (default, exact name), "regex" (regex pattern), "wildcard" (* and ?), "partial" (substring search) | |
| grammar_content | No | The content of the ANTLR4 grammar file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It explains the default matching mode, the different behavior for exact vs. pattern matches, and the return data (rule definition, fan-in/fan-out, usage count). It lacks an explicit statement that this is a read-only operation, which would push it to 5.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a clear summary, 'When to use' section, labeled matching modes with examples, and a 'Returns' section. It is moderately sized but every sentence earns its place, and the use of bullet points enhances scannability.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
There is no output schema, so the description must explain return values, and it does: it details what is returned for exact matches (definition, type, line number, fan-in/fan-out, usage count) and for pattern matches (matching rules, match count). Combined with thorough coverage of matching modes, this makes the tool context complete for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% (baseline 3), but the description adds significant value by giving concrete examples for each matching mode and explaining how rule_name is interpreted differently in each mode (e.g., regex syntax, wildcard characters, case-insensitive partial). This goes beyond the schema's simple parameter descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Find rules with multiple matching modes' and clearly distinguishes itself from siblings like list-rules and find-rule-usages by emphasizing pattern matching. It explicitly names four matching modes, leaving no ambiguity about the tool's purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section provides clear context: 'Locate specific rules, understand rule relationships, or discover rules matching a pattern.' However, it does not explicitly mention when not to use it or name alternative sibling tools, so it stops short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
find-rule-usagesA
Find all locations where a specific rule is referenced with line numbers and context.
When to use: Before renaming/removing rules to understand impact, analyze dependencies, or trace rule usage.
Example usage: rule_name: "expression"
Returns:
Total usage count
Per-usage details: line number, rule context (which rule contains the reference)
Complete usage report
Multi-file support:
Set load_imports: true to search across imported grammars
Useful for finding cross-file dependencies
Use before:
Renaming rules (to see what will be affected)
Removing rules (to identify breaking changes)
Refactoring (to understand dependencies)
| Name | Required | Description | Default |
|---|---|---|---|
| base_path | No | Optional: base directory for resolving imports. Required for multi-file grammars. | |
| from_file | No | Optional: path to a grammar file to read | |
| rule_name | Yes | The name of the rule to find usages for (case-sensitive) | |
| load_imports | No | Optional: if true, search across imported grammars. Default: false. | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full behavioral burden. It discloses the return payload (total usage count, per-usage details, complete report) and the multi-file behavior via load_imports. It does not state error behaviors or prerequisites, but for a read-only tool the core actions and outputs are clearly conveyed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with clear sections (When to use, Example usage, Returns, Multi-file support, Use before). It is slightly longer than necessary, and the 'Use before' section partially repeats the 'When to use' content, but every section contributes to practical usage. Overall it is effective and not bloated.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has 5 parameters, no output schema, and no annotations, the description covers the key aspects: what it does, when to use it, what it returns, and a notable multi-file option. It could be more complete with error handling or prerequisites, but it is sufficient for an agent to select and invoke the tool correctly in most situations.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds some context beyond the schema, such as the example usage for rule_name and the purpose of load_imports for cross-file dependencies. However, it does not significantly enrich the understanding of base_path, from_file, or grammar_content, which are already well described in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Find all locations where a specific rule is referenced with line numbers and context.' This clearly distinguishes it from siblings like find-rule (which locates a rule definition) and impact-analysis (which assesses impact). The purpose is unambiguous and actionable.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit 'When to use' and 'Use before' sections, listing concrete scenarios like renaming, removing, and refactoring rules. However, it does not explicitly mention when not to use the tool or name alternatives, so it falls short of the 5-level criteria but is still strong guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
fix-quantifier-issuesA
Selectively fix suspicious quantifier patterns - change )? to )* for specific rules.
When to use: After detect-quantifier-issues identifies problems.
Workflow:
Run detect-quantifier-issues to see what's suspicious
Review the suggestions
Run fix-quantifier-issues with specific rule_names to fix
What it fixes:
Rules with alternatives: (a | b | c)? → (a | b | c)*
Multiple optional elements that suggest repetition
Collection-named rules (_rules, _settings) using )?
Examples:
// Step 1: Detect issues detect-quantifier-issues(from_file: "PaloAlto_interface.g4") → Shows: snie_ethernet, snie_lacp, sniel_high_availability, snil_units
// Step 2: Fix specific rules fix-quantifier-issues( from_file: "PaloAlto_interface.g4", rule_names: ["snie_ethernet", "snie_lacp", "snil_units"] ) → Fixes only those 3 rules
// Fix all detected issues fix-quantifier-issues(from_file: "PaloAlto_interface.g4") → Fixes all suspicious patterns
// Preview without changing fix-quantifier-issues( from_file: "PaloAlto_interface.g4", dry_run: true ) → Shows what would change
Real-world: Palo Alto grammar had 15 rules flagged. User fixed 12, left 3 as-is (they were correct).
Returns: List of changes with line numbers and reasoning
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | If true, shows what would change without modifying. Default: false | |
| from_file | No | Optional: path to a grammar file to read | |
| rule_names | No | Optional: Array of specific rule names to fix. If omitted, fixes all suspicious patterns | |
| output_mode | No | Output mode: "full" returns complete grammar, "diff" returns git-style diff (default: diff), "none" returns no content | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
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: the transformation performed, selective fixing via rule_names, preview capability with dry_run, and the return format (list of changes with line numbers and reasoning). It does not fully explain the interplay between write_to_file, output_mode, and grammar_content, but it is not misleading and provides substantial behavioral context beyond a bare minimum.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear headings, a workflow list, code examples, and a real-world anecdote. Every section serves a purpose: summary, when to use, workflow, what it fixes, examples, and return info. It is somewhat long but avoids fluff, and the structure makes it easy to scan. The real-world paragraph adds credibility but is slightly tangential.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (6 optional parameters, no output schema), the description is quite complete. It covers when to use, exactly what it fixes, how to select rules, preview behavior, and return details. The only noticeable gap is not explaining how grammar_content relates to from_file or how write_to_file and output_mode behave together, but the examples and workflow cover the main usage scenarios.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds meaningful usage examples (e.g., from_file, rule_names, dry_run) and clarifies that omitting rule_names fixes all suspicious patterns. It does not add detail on grammar_content, but the workflow focuses on from_file, and the examples illustrate the intended usage patterns effectively.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Selectively fix suspicious quantifier patterns - change )? to )* for specific rules.' This is a specific verb (fix) and resource (quantifier patterns in grammar rules), and it distinguishes itself from the sibling tool detect-quantifier-issues by framing it as the follow-up action. The 'What it fixes' section adds concrete pattern examples, making the purpose unmistakable.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says 'When to use: After detect-quantifier-issues identifies problems' and provides a clear workflow (detect → review → fix). It gives examples for fixing specific rules, fixing all, and previewing with dry_run, which clarify when to include rule_names and when to omit it. This is strong guidance with explicit alternatives and exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
format-grammarA
Display a structured summary of the grammar with proper formatting.
When to use: Get a high-level overview of grammar organization and structure.
Returns:
Grammar name and type
Complete rule list (organized by type)
Import declarations
Grammar options
Issue summary with counts
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The content of the ANTLR4 grammar file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavior. It discloses the tool's output in detail (grammar name/type, rule list, imports, options, issue summary with counts). The verb 'Display' implies a read-only operation, providing implicit transparency. It does not, however, explicitly state that no modifications are made or discuss any edge cases.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured, opening with the main purpose, then 'When to use,' then a bulleted list of returned items. Every sentence earns its place; no redundant content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a display tool with two optional parameters and no output schema, the description is fairly complete: it covers purpose, usage context, and return values. Minor gap is not specifying input requirements (e.g., at least one of from_file or grammar_content) or how the tool handles missing input, but overall it's sufficient for an agent to decide and invoke.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds no additional parameter semantics beyond the schema; it does not explain when to use from_file vs grammar_content or relationship between them.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool 'Displays a structured summary of the grammar with proper formatting,' which is a specific verb-resource combination. However, it does not explicitly distinguish this from sibling tools like generate-summary or export-as-markdown, which may also produce grammar summaries.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It provides a 'When to use' section saying to use it for a high-level overview of grammar organization and structure. This gives clear context, though it does not explicitly exclude alternatives or reference sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate-stress-testA
Generate stress test inputs for grammar performance testing.
When to use: Testing grammar robustness, identifying performance issues, benchmarking.
Generation strategies:
nested: Deep nesting of recursive rules (tests stack depth)
wide: Many alternatives in choice rules (tests branching)
repetition: Repeated sequences (tests loops)
mixed: Combination of all strategies (default)
Parameters:
grammar_content: The grammar to generate tests for
strategy: Generation strategy (nested, wide, repetition, mixed)
depth: Nesting depth for nested strategy (default: 50)
count: Number of alternatives for wide strategy (default: 100)
repetitions: Repetition count for repetition strategy (default: 100)
Returns:
Generated test input
Expected characteristics (depth, width, size)
Warnings if grammar structure can't support requested strategy
Example: grammar_content: "grammar Expr; ..." strategy: "nested" depth: 30
Output: "(((...(1 + 2)...)))" (30 levels deep)
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of alternatives for wide strategy (default: 100) | |
| depth | No | Nesting depth for nested strategy (default: 50) | |
| strategy | No | Generation strategy (default: mixed) | |
| from_file | No | Optional: path to a grammar file to read | |
| repetitions | No | Repetition count for repetition strategy (default: 100) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses generation strategies, expected returns, and that warnings are produced if the grammar can't support a strategy. It does not mention potential performance/resource implications of stress testing or side effects, but the core behavior is well-covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with clear sections (When to use, Generation strategies, Parameters, Returns, Example). Each section adds value: the example illustrates usage, the strategy list clarifies options, and the returns section sets expectations. No fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With 6 parameters and no output schema, the description covers most essentials: strategies, returns, example. It misses mentioning 'from_file' in the parameter list, but the schema covers it. The example and returns section help complete the picture, slightly imperfect but adequate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 repeats parameter names and defaults, adding minimal extra meaning. It also omits 'from_file' from the parameter list, but the schema describes it. No additional syntax or semantics beyond schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description starts with 'Generate stress test inputs for grammar performance testing' - a specific verb and resource, clearly distinguishing it from sibling tools like test-parser-rule or benchmark-parsing. The scope is well-defined.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
An explicit 'When to use' section states: 'Testing grammar robustness, identifying performance issues, benchmarking.' This gives clear context. However, it does not mention when not to use or compare with alternatives, so a deduction from 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate-summaryA
Generate a concise summary of grammar structure and health metrics.
When to use: Quick health checks, progress tracking, overview reports, or grammar comparisons.
Example usage: from_file: "MyGrammar.g4"
Returns:
Grammar name and type
Total rule count (parser/lexer breakdown)
Import declarations
Top 5 most referenced rules (indicating key grammar components)
Issue summary (error/warning/info counts)
Grammar health assessment
Complexity indicators
Perfect for: Status reports, quick assessments, tracking changes over time.
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavioral disclosure. It discloses the return structure with a detailed list of expected outputs, which is helpful, but it does not explicitly state that the operation is non-mutating or describe behavior when input parameters are omitted or both provided. The read-only nature is implied but not stated.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with clear sections and is front-loaded with the purpose. It includes an example and a concise return list, though there is some redundancy between the 'When to use' and 'Perfect for' sections, making it slightly longer than necessary.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of an output schema, the description thoroughly enumerates all return values, covering grammar name, rule counts, imports, top rules, issue summary, health assessment, and complexity indicators. It also provides usage context and an example, making it adequate for an agent to understand the tool's function and expected output.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema provides full descriptions for both parameters (100% coverage), so the baseline is 3. The description adds a concrete example using 'from_file', but does not clarify the relationship between the two parameters (e.g., whether they are alternatives or additive) or what occurs if none are provided.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool 'Generate a concise summary of grammar structure and health metrics,' which identifies the verb and resource. It distinguishes itself as a summary tool rather than a detailed analysis or validation tool, though it does not explicitly compare with sibling tools like 'grammar-metrics'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a dedicated 'When to use' section listing quick health checks, progress tracking, overview reports, and grammar comparisons. It also adds a 'Perfect for' line with status reports and tracking changes, giving clear context for when this tool is appropriate, though it lacks explicit exclusions or alternative tool references.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate-tokens-from-patternA
Generate lexer tokens automatically from natural language input patterns.
When to use:
Quick token generation from sample input text
Convert configuration snippets into grammar rules
Generate tokens from command examples
Prototype grammars from example input
Example - Generate tokens from command: input_pattern: "ignore config system ftm-push" → Generates: IGNORE, CONFIG, SYSTEM, FTM_PUSH tokens
Example - Generate single compound token: input_pattern: "config-system-admin" tokenize: false → Generates: CONFIG_SYSTEM_ADMIN token
Example - Add prefix to generated tokens: input_pattern: "show running-config" prefix: "CMD" → Generates: CMD_SHOW, CMD_RUNNING_CONFIG tokens
Features:
Automatic tokenization (splits on whitespace by default)
Intelligent name generation (uppercase with underscores)
Optional prefix for token namespacing
Supports all standard token options (skip, channel, fragment)
Generates proper ANTLR4 string literal patterns
Returns:
List of generated tokens with names and patterns
Per-rule success/failure status
Modified grammar
Summary of results
| Name | Required | Description | Default |
|---|---|---|---|
| skip | No | If true, adds "-> skip" directive to all generated tokens | |
| prefix | No | Optional: Prefix to add to all generated token names | |
| channel | No | Optional: Channel name for all generated tokens | |
| fragment | No | If true, marks all generated tokens as fragments | |
| tokenize | No | If true (default), splits input into individual tokens. If false, creates single token. | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| input_pattern | Yes | Input text to generate tokens from (e.g., "ignore config system ftm-push") | |
| write_to_file | No | If true, writes modified grammar back to from_file | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: automatic tokenization, intelligent name generation, optional prefix support, support for token options (skip, channel, fragment), and generation of ANTLR4 string literal patterns. It also lists return values (list of tokens, per-rule status, modified grammar, summary). It does not explicitly warn about potential file mutation via write_to_file, but that is disclosed in the schema. The description provides substantial behavioral detail beyond 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.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is structured with clear sections (When to use, Examples, Features, Returns) and uses bold headers. While it is relatively long (~200 words), every section contributes useful information. The examples are concrete and aid comprehension. It is not overly verbose, but could be slightly trimmed without losing value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has 9 parameters and no output schema, so the description must cover return values and behavior. It does so by listing output categories and providing examples. It also covers most relevant scenarios (tokenization, prefixing, token options). It does not fully explain the interplay between from_file and write_to_file, but that is available in the parameter descriptions. Overall, it is quite complete for a complex tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so baseline is 3. The description adds value beyond the schema through concrete examples illustrating how to use input_pattern, tokenize, and prefix. The features section also explains the tokenization behavior that parameters like tokenize control. This enhances understanding of parameter semantics without duplicating schema text.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a clear verb+resource: 'Generate lexer tokens automatically from natural language input patterns.' The examples further clarify the exact functionality, and this is distinct from sibling tools like 'preview-tokens' (which likely previews tokens) or 'add-tokens-with-template' (which uses templates). The purpose is unambiguous and well-differentiated.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section lists specific scenarios (quick token generation, converting configuration snippets, generating tokens from command examples, prototyping grammars). This provides clear context for when the tool is appropriate. It does not explicitly mention alternatives or exclusions relative to sibling tools, which would push it to a 5, but the guidance is sufficient for selecting it in common cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get-suggestionsA
Get actionable improvement suggestions for an ANTLR4 grammar.
When to use: Optimize grammar quality, identify issues, get best practice recommendations.
Analyzes:
Naming convention compliance (uppercase lexer, lowercase parser)
Rule complexity and performance concerns
Unused rules that could be removed
Undefined references
Fragment opportunities for code reuse
Left recursion patterns
Returns: Categorized suggestions with specific recommendations for improvement.
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The content of the ANTLR4 grammar file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does a good job: it lists what the tool analyzes (naming, complexity, unused rules, etc.) and states it returns 'categorized suggestions with specific recommendations.' It does not explicitly say 'does not modify the grammar,' but the use of 'Analyzes' and 'Returns' implies a read-only operation, though a direct statement would have been ideal.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured: it opens with a one-sentence purpose, includes a clear 'When to use' inset, uses a tight bullet list for analysis categories, and closes with a one-line return summary. Every word earns its place; it is informative without being verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity, the description covers the main aspects: what it does, when to use it, what it analyzes, and the general nature of its return value. However, the 'Returns' line is somewhat vague ('Categorized suggestions') without an output schema, and it doesn't clarify parameter interaction (e.g., precedence between `from_file` and `grammar_content`). Overall, it is sufficient for most use cases but has minor gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with both `from_file` and `grammar_content` fully described. The description itself adds no additional parameter semantics, such as precedence rules when both are provided or behavior when neither is given. The baseline of 3 applies because the schema already documents parameter meanings thoroughly.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool 'Get actionable improvement suggestions for an ANTLR4 grammar' with a specific verb and resource. It lists six concrete analysis categories (naming conventions, complexity, unused rules, etc.), which both clarifies scope and differentiates it from sibling tools like validate-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.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section explicitly says 'Optimize grammar quality, identify issues, get best practice recommendations,' providing clear context for when this tool is appropriate. However, it does not mention when not to use it or name alternative tools, so it stops short of full exclusion guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
grammar-metricsA
Calculate comprehensive grammar metrics including branching estimation, complexity, and dependencies.
When to use: Understanding grammar complexity, identifying optimization opportunities, estimating parsing performance.
Metrics included:
Size Metrics:
Total/parser/lexer rule counts
Fragment counts
Lines of code, average rule length
Branching Metrics:
Average/max alternatives per rule
Branching depth (subrule nesting)
Branching distribution (1-2, 3-5, 6-10, 10+)
Rules with most branching
Complexity Metrics:
Cyclomatic complexity (per rule and total)
Recursive rules detection
Estimated parse complexity (low/medium/high/very-high)
Dependency Metrics:
Fan-in/fan-out averages
Orphan rules (unused)
Hub rules (highly referenced)
Most referenced rules
Example: from_file: "MyGrammar.g4"
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. The verb 'Calculate' strongly implies a read-only operation, and the description thoroughly details the metrics returned, giving the agent a good sense of the output behavior. It does not mention explicit side-effect safety (e.g., 'modifies nothing'), but for a calculation tool this is adequate. It also does not disclose handling of invalid input or file-reading errors, but that's a minor gap given the metric richness.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is moderately long but well-structured with clear headers and bullet points. It front-loads the primary purpose and usage context before diving into metrics. Each metric category is listed concisely, and the example is useful. It could be slightly trimmed, but the structure makes it easily scannable for an agent.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has a moderate complexity with a simple parameter schema (2 optional params) and no output schema. The description compensates by enumerating all metric categories in detail, giving an agent a clear picture of expected results. It includes an example invocation. The main gap is not describing the exact return format (e.g., JSON keys), but the metric breakdown serves as a sufficient surrogate. Overall, the description is complete enough for a knowledgeable agent to invoke correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% and both parameters are described individually: 'Optional: path to a grammar file to read' and 'The ANTLR4 grammar file content'. The description adds an example using from_file, which is helpful but does not add new semantic nuance beyond the schema. There is no mention of mutual exclusivity or precedence between the two parameters, so the description does not significantly elevate parameter understanding beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb-object phrase: 'Calculate comprehensive grammar metrics including branching estimation, complexity, and dependencies.' This clearly distinguishes it from sibling tools like analyze-grammar or rule-statistics by specifying the exact metric categories. The detailed breakdown of metrics further reinforces the unique scope of this tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
A dedicated 'When to use:' section provides explicit context: 'Understanding grammar complexity, identifying optimization opportunities, estimating parsing performance.' This gives an agent clear scenarios for invocation. However, it does not explicitly state when not to use the tool or mention alternative sibling tools, so it misses a full exclusion/alternative guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
helpA
Get comprehensive help about ANTLR4 MCP tools, common workflows, and usage examples.
USE THIS TOOL FIRST when starting work with ANTLR4 grammars.
Available topics:
"overview": Summary of all 27 available tools by category
"workflows": Common multi-step workflows for typical tasks
"analysis": Detailed info about analysis and inspection tools
"authoring": Detailed info about editing and modification tools
"refactoring": Detailed info about refactoring and optimization tools
"examples": Practical examples of tool usage
Returns: Comprehensive documentation for the requested topic.
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | Help topic to retrieve. Use "overview" for a general introduction. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full responsibility for disclosing behavior. It clearly explains that the tool returns "Comprehensive documentation for the requested topic" and lists what each topic covers. It does not explicitly state side-effect-free behavior, but for a help tool this is largely implied.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and highly structured: a bold usage directive, a compact bulleted list of topics, and a one-line return statement. Every sentence earns its place, and key guidance is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given that this is a simple one-parameter help tool with no output schema, the description is complete. It tells the agent when to use it, what topics are available, and what to expect in return. No critical information is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already describes the parameter and its enum, so baseline is 3. The description adds value by explaining what each enum value represents, such as "overview: Summary of all 27 available tools by category" and "workflows: Common multi-step workflows for typical tasks," going beyond the bare enum names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: "Get comprehensive help about ANTLR4 MCP tools, common workflows, and usage examples." It uses a specific verb (get help) and resource (ANTLR4 MCP tools), effectively distinguishing this meta-tool from the many grammar-manipulation sibling tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives explicit usage guidance: "USE THIS TOOL FIRST when starting work with ANTLR4 grammars." It also enumerates the available topics and suggests "overview" for a general introduction, which helps the agent choose the correct starting point.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
impact-analysisA
Analyze change impact for a specific rule (dependencies, dependents, and risk).
When to use: Before renaming, deleting, or heavily modifying a rule.
Returns:
Direct/transitive dependencies (what this rule needs)
Direct/transitive dependents (what would be affected)
Usage count and recursion status
Entry-rule detection and risk level
Actionable impact summary
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to grammar file to analyze | |
| rule_name | Yes | Rule name to analyze for downstream and upstream impact | |
| grammar_content | No | The ANTLR4 grammar content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses the return values (dependencies, dependents, usage count, recursion status, entry-rule detection, risk level, summary), which conveys behavioral traits. It doesn't explicitly state read-only behavior or clarify side effects, but 'analyze' implies a safe read operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a summary line, a when-to-use callout, and a bullet list of returns. It is concise, front-loaded, and every sentence adds valuable context.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description lists the key output categories, covering what the tool returns. The when-to-use guidance and clear purpose make it complete enough for an agent to select and invoke the tool correctly. Minor gaps exist around parameter precedence and edge cases, but these are not critical for basic usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, with each parameter having a description. The tool description doesn't add additional parameter semantics beyond what the schema provides, so the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description explicitly states the tool analyzes change impact for a specific rule, listing dependencies, dependents, and risk. This is a specific verb+resource+scope that distinguishes it from siblings like find-rule-usages by focusing on impact analysis.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a clear 'When to use' instruction: before renaming, deleting, or heavily modifying a rule. It doesn't mention alternatives or when not to use, so it gives clear context without explicit exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
infer-formattingA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The content of the ANTLR4 grammar file |
TDQS
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.
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.
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.
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.
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.
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.
inline-ruleA
Inline a rule by replacing all references with its definition, then delete the original rule.
When to use:
Remove "pass-through" or helper rules
Simplify grammar structure
Clean up unnecessary indirection
Inverse of extract-fragment refactoring
How it works:
Validates rule can be inlined (no circular references, not recursive, actually used)
Extracts rule body (removes labels, actions preserved)
Finds all references to the rule
Replaces references with rule body (adds parentheses if needed)
Removes original rule definition
Example - Simple pass-through: rule_name: "additiveExpression" // Before: expression: additiveExpression; // additiveExpression: term ((PLUS | MINUS) term); // After: expression: term ((PLUS | MINUS) term);
Example - Helper rule: rule_name: "value" // Before: assignment: ID ASSIGN value SEMI; // value: NUMBER | STRING | ID; // After: assignment: ID ASSIGN (NUMBER | STRING | ID) SEMI;
Features:
Circular reference detection
Smart parenthesization
Multi-reference support
Dry-run mode available
Detailed statistics
Returns:
Modified grammar with rule inlined
Number of references replaced
List of affected rules
Original rule definition
Validates:
Rule exists
Not self-recursive
No circular dependencies
Actually used somewhere
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | If true, shows what would change without modifying grammar | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| rule_name | Yes | Name of the rule to inline (e.g., "helper", "value") | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| grammar_content | No | The ANTLR4 grammar file content | |
| preserve_parentheses | No | If true, always wrap inlined body in parentheses (safer but verbose). Default: auto-detect |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden, and it excels. It details validation steps (no circular refs, not recursive, actually used), the replacement process including parenthesization, and deletion of the original rule. It also mentions dry-run mode and statistics, giving a thorough picture of side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear headers, bullet points, and concrete examples. It front-loads the core purpose, then flows into usage, behavior, and return values. Every section provides distinct value and nothing is redundant or verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has 6 parameters and no output schema, the description covers all necessary context: what it does, when to use, how it works internally, validation checks, return values, and examples. The agent can confidently invoke this tool and interpret its effects without additional information.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 context beyond the schema: it explains the effect of preserve_parentheses ('Smart parenthesization', 'adds parentheses if needed'), the dry-run concept, and the relationship between from_file and write_to_file through usage examples. It doesn't deeply explain every parameter but adds meaningful nuance.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The first sentence precisely explains the operation: 'Inline a rule by replacing all references with its definition, then delete the original rule.' This names a specific verb and resource, and the description differentiates it from siblings like extract-fragment by labeling itself as the inverse. No ambiguity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section explicitly lists scenarios (pass-through rules, simplifying structure, reducing indirection) and states it is the inverse of extract-fragment. This directly guides the agent on when to choose this tool over alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list-mode-rulesA
List all lexer rules in a specific mode.
When to use: Quick inspection of mode contents, debugging mode issues, understanding mode structure.
Returns:
List of rules with names, patterns, and line numbers
Total count of rules in the mode
Example - List rules in STRING_MODE: mode_name: "STRING_MODE"
Example - List rules in DEFAULT_MODE: mode_name: "DEFAULT_MODE"
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| mode_name | Yes | Name of the mode to list rules from | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly explains the return format (list of rules with names, patterns, line numbers, and total count), which is essential. It does not discuss side effects, but for a read-only list operation this is adequate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections, bullet points, and examples. Every sentence serves a purpose, and the examples are informative without being redundant. It is appropriately sized for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has only one required parameter, no output schema, and no annotations, the description covers the key aspects: purpose, when to use, return values, and usage examples. It does not address potential errors or the source of grammar content, but the schema covers those details. Overall, it is nearly complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds value by providing concrete examples for the mode_name parameter (e.g., 'STRING_MODE', 'DEFAULT_MODE'), which helps the agent understand acceptable values beyond the schema's generic name description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'List all lexer rules in a specific mode.' This is a specific verb+resource+scope combination that distinguishes it from sibling tools like list-rules, which likely lists rules globally rather than per mode.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a 'When to use' section with concrete scenarios (quick inspection, debugging mode issues, understanding structure). However, it does not explicitly mention alternatives or when not to use this tool, so it falls short of a perfect 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list-rulesA
List all rules in an ANTLR4 grammar with optional filtering.
When to use: Get a quick overview of all rules, or filter to see only lexer or parser rules.
Example usage: filter_type: "lexer" // Shows only lexer rules (uppercase) filter_type: "parser" // Shows only parser rules (lowercase) filter_type: "all" // Shows all rules (default)
Returns: Alphabetically sorted list of rules with:
Rule names
Rule types (lexer/parser)
Complete definitions
Line numbers
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| filter_type | No | Filter rules by type (default: all) | |
| grammar_content | No | The content of the ANTLR4 grammar file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses the output format (alphabetically sorted list, rule names, types, definitions, line numbers) and explains filter_type behavior with examples. However, it does not explain what happens if both from_file and grammar_content are provided or if neither is provided, leaving minor ambiguity.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections: main action, when to use, example, and returns. It is somewhat lengthy but each part provides useful information, with no redundant filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is a read-only listing operation with no output schema, so the description adequately covers purpose, usage, and return format. Gaps remain around input source precedence and handling of multiple input parameters, but overall it is complete enough for an agent to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds value by providing example usage for filter_type, including the semantic detail that lexer rules are uppercase and parser rules are lowercase. This goes beyond the schema's basic 'Filter rules by type'.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists all rules in an ANTLR4 grammar with optional filtering. It is specific ('List all rules') and identifies the resource ('ANTLR4 grammar'), but does not explicitly differentiate from the sibling tool 'list-mode-rules'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section provides context: getting a quick overview or filtering by lexer/parser. It does not mention exclusions or mention alternative tools, so it stops short of explicit when-not guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
merge-rulesA
Merge two related rules into one rule with alternatives.
When to use: Consolidate similar rules, reduce rule count, group related alternatives.
Example - Merge literal rules: rule1_name: "intLiteral" rule2_name: "floatLiteral" new_rule_name: "numericLiteral"
Result: numericLiteral: intLiteral | floatLiteral
Benefits:
Reduces grammar complexity
Groups related alternatives logically
Simplifies parser structure
Note: Original rules are removed; references to them should be updated manually or use rename-rule first.
Returns: Modified grammar with merged rule created and original rules removed.
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| rule1_name | Yes | Name of the first rule to merge (will be removed) | |
| rule2_name | Yes | Name of the second rule to merge (will be removed) | |
| new_rule_name | Yes | Name for the merged rule (must follow ANTLR4 naming conventions) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It explicitly states that original rules are removed, references need manual updates, and the return value is a modified grammar. This fully discloses the side effects and output behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections: core action, when to use, example, benefits, and a note on side effects. It is front-loaded with the essential purpose and usage, and every sentence adds value. The length is appropriate for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the moderate complexity (5 parameters, no output schema), the description fully covers the needed context: what the tool does, when to use it, an example, side effects, and return value. The schema and description together provide complete information for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with each parameter already described in the input schema. The description adds context about the merge behavior (originals removed) and includes an example, but it does not significantly enhance 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.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Merge two related rules into one rule with alternatives.' This is a specific verb+resource combination that distinguishes it from sibling tools like add-rule, remove-rule, and rename-rule. The example with intLiteral/floatLiteral/numericLiteral further clarifies the intended operation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
An explicit 'When to use' section lists concrete scenarios: consolidate similar rules, reduce rule count, group related alternatives. It also mentions 'or use rename-rule first' for updating references, providing an alternative strategy. This gives clear guidance for when to select this tool over siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
move-ruleA
Move an existing rule to a new position relative to another rule.
When to use: Reorganizing grammar, grouping related rules, fixing rule order.
Use cases:
Move related rules together for better organization
Position rules before/after their dependencies
Group similar functionality
Manual rule ordering (alternative to sort-rules)
Features:
Preserves rule formatting (multi-line, comments)
Maintains blank lines between rules
Validates both rule and anchor exist
Detects if rule is already in target position
Example usage:
Move expr rule before term rule: rule_name: "expr" position: "before" anchor_rule: "term"
Move NUMBER token after PLUS token: rule_name: "NUMBER" position: "after" anchor_rule: "PLUS" write_to_file: true
Note: This moves EXISTING rules. To insert NEW rules at specific positions, use add-parser-rule or add-lexer-rule with insert_before/insert_after.
| Name | Required | Description | Default |
|---|---|---|---|
| position | Yes | Move rule before or after the anchor rule | |
| from_file | No | Optional: path to a grammar file to read | |
| rule_name | Yes | Name of the rule to move | |
| anchor_rule | Yes | Name of the rule to use as anchor/reference point | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses preservation of formatting, blank line maintenance, validation of rule and anchor existence, and detection of already-in-position. This is useful behavioral context, though it doesn't specify error handling or return behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Well-structured with sections (When to use, Use cases, Features, Example, Note). It is longer than a single sentence but each section adds value. Front-loaded with a clear one-liner purpose. Slightly verbose but appropriate for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given schema covers all parameters and no output schema, the description still explains when to use, features, examples, and alternatives. It does not describe return values or in-memory vs file write behavior beyond the write_to_file param, but overall it is sufficiently complete for an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so baseline is 3. The description adds example usage for rule_name, position, anchor_rule, and write_to_file, but does not add new semantic meaning beyond the schema's parameter descriptions. The examples clarify relationships but the schema already defines them.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool moves an existing rule to a new position relative to another rule. It distinguishes from siblings like sort-rules and move-rule-to-mode by specifying it reorganizes within the same context, and explicitly contrasts with add-rule for new rules.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit 'When to use' section listing reorganization scenarios, plus concrete use cases. It also gives a clear exclusion: 'This moves EXISTING rules. To insert NEW rules... use add-parser-rule or add-lexer-rule' — good alternative guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
move-rule-to-modeA
Move an existing lexer rule to a different mode.
When to use: Reorganizing lexer rules, fixing mode placement, refactoring grammar structure.
Features:
Moves lexer rules between modes
Preserves rule definition exactly
Validates source rule exists and is a lexer rule
Validates target mode exists
Example - Move rule to STRING_MODE: rule_name: "STRING_CONTENT" target_mode: "STRING_MODE" write_to_file: true
Note: Parser rules cannot be moved to modes (they don't have mode context).
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| rule_name | Yes | Name of the lexer rule to move | |
| output_mode | No | Output format: "full", "diff", or "none" | |
| target_mode | Yes | Name of the mode to move the rule to | |
| write_to_file | No | If true, writes modified grammar back to from_file | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Features list discloses validation behaviors and preservation of the rule definition. However, it does not explain side effects like whether the source rule is removed, default write behavior, or what the output modes ('full', 'diff', 'none') produce. With no annotations, these gaps leave important behavioral aspects unexplained.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Well-structured with clear sections: purpose, when-to-use, features, example, and note. Every section earns its place, the example is minimal, and the overall length is appropriate for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers purpose, usage, and validation but omits output behavior and how the tool interacts with the file (e.g., whether write_to_file is required for persistence). Since there is no output schema, the description should explain return values or output modes, which it currently does not.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and descriptions are already in the schema. The example adds a concrete usage pattern but does not add meaning beyond the schema fields. It serves as an illustration rather than additional explanation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The opening sentence 'Move an existing lexer rule to a different mode' uses a specific verb and resource, and the scope is clearly distinguished from siblings like move-rule (generic) and add-rule-to-mode (create new). The note about parser rules further narrows the purpose to lexer rules only.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides a 'When to use' section with three concrete scenarios and an explicit exclusion (parser rules cannot be moved). However, it does not name alternative tools such as 'add-rule-to-mode' or 'move-rule', which could help an agent choose between them.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
native-benchmarkA
Benchmark grammar using actual ANTLR4 Java runtime (most accurate).
When to use: Final performance testing, comparing grammars, production validation.
Requirements:
Java must be installed
ANTLR4 JAR must be available (auto-downloads to ~/.local/lib/)
Features:
Uses real ANTLR4 parser (100% accurate)
Low-overhead Java driver (avoids JVM startup per iteration)
Warmup iterations for JIT optimization
Supports multi-file grammars
Parameters:
grammar_files: Object mapping filename to content {"Expr.g4": "grammar Expr..."}
start_rule: Parser rule to start from
input: Sample input text
iterations: Timed iterations (default: 10)
warmup_iterations: Warmup runs (default: 3)
Example: grammar_files: {"Expr.g4": "grammar Expr; start: expr EOF; ..."} start_rule: "start" input: "1 + 2 * 3" iterations: 20
Returns:
Avg/min/max parse time
Throughput (chars/sec, tokens/sec)
Performance rating (excellent/good/fair/slow)
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Input text to parse | |
| iterations | No | Number of timed iterations (default: 10) | |
| start_rule | Yes | Parser rule to start parsing from | |
| grammar_files | Yes | Map of filename to grammar content | |
| warmup_iterations | No | Warmup runs before timing (default: 3) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full responsibility for behavioral disclosure. It reveals meaningful details such as auto-downloading the ANTLR JAR to ~/.local/lib/, using a low-overhead Java driver, and performing warmup iterations. This goes well beyond a simple 'benchmark' label.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized into clear sections (When to use, Requirements, Features, Parameters, Returns). The parameter section somewhat redundantly repeats schema descriptions, but the overall structure is scannable and each section contributes useful context.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Although there is no output schema, the description explicitly lists return values (avg/min/max, throughput, performance rating), requirements, and an example. This makes the tool's behavior and results understandable without needing additional documentation. It is comprehensive given the tool's complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the schema already documents all parameters. The description duplicates this information but adds a concrete example of grammar_files and start_rule usage. This provides marginal value beyond the schema, matching the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool benchmarks grammars using the actual ANTLR4 Java runtime, which is a specific and distinct action. It emphasizes 'most accurate' and differentiates from sibling benchmarking tools by highlighting the real runtime.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section explicitly names final performance testing, comparing grammars, and production validation. It provides clear context but does not explicitly list exclusions or alternative tools, so it falls just short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
preview-tokensA
Preview how input text would be tokenized by lexer rules. Test grammar changes instantly!
🚀 Native ANTLR4 Support: Automatically uses native ANTLR4 runtime if available for 100% accurate tokenization including:
✅ Lexer modes (pushMode, popMode)
✅ Semantic predicates ({...?})
✅ Actions ({...})
✅ All ANTLR4 features
Falls back to simulation if ANTLR4 is not installed (works for simple grammars without modes/predicates).
When to use:
Test if lexer rules match input as expected
Debug tokenization issues (especially with complex grammars!)
Verify grammar changes work correctly
Learn how ANTLR4 tokenizes input
Setup for 100% accuracy (optional):
Install Java: brew install openjdk
Install ANTLR4: wget https://www.antlr.org/download/antlr-4.13.1-complete.jar
Set env: export ANTLR4_JAR=/path/to/antlr-4.13.1-complete.jar
How it works:
Native mode: Compiles and executes actual ANTLR4 lexer (100% accurate)
Simulation mode: Best-effort tokenization (works for ~70% of grammars)
Example - Test basic tokenization: input: "x = 42;"
Example - Test with complex lexer (Palo Alto): from_file: "PaloAlto_lexer.g4" load_imports: true input: "set user-id-collector enable-mapping-timeout 1"
Example - Test specific rules only: input: "x + y * 2" rules_to_test: ["ID", "PLUS", "TIMES", "INT"]
Returns:
List of tokens with types and values
Character positions (start, end, line, column)
Channel information for channeled tokens
Errors for unmatched characters
Mode indicator (🚀 Native or ⚠️ Simulation)
Feature warnings if simulation used
Limitations:
❌ Lexer modes not supported
❌ Semantic predicates not evaluated
❌ Actions not executed
⚠️ Fragment rules (basic support)
⚠️ Complex patterns (best-effort)
Alternative: For complex grammars, use test-parser-rule which tests parser rules without full lexer simulation.
Note: This is a simplified simulation. For 100% accuracy, use ANTLR4 tooling.
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Input text to tokenize. Can include newlines and special characters. | |
| from_file | No | Optional: path to a grammar file to read | |
| rules_to_test | No | Optional: Test only specific lexer rules (by name). Useful for focused testing. | |
| show_positions | No | If true, show detailed position information (line, column, start, end) for each token | |
| grammar_content | No | The ANTLR4 grammar file content with lexer rules |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full behavioral burden. It clearly explains native ANTLR4 mode versus simulation fallback, details simulation limitations (lexer modes, predicates, actions), and describes return values including feature warnings and mode indicators. No contradictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections and front-loaded purpose, but it is verbose with emojis, repeated limitations, and extensive setup instructions. It could be trimmed by ~30% without losing essential information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers behavior, setup, examples, return format, limitations, and alternatives. Since there is no output schema, the detailed Returns section is essential and fully compensates for that gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema covers 100% of parameters, so baseline is 3. The description adds rich examples for input, from_file, and rules_to_test, clarifying usage beyond dry schema definitions. However, one example references 'load_imports: true', which is not an actual parameter, creating minor confusion.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Preview how input text would be tokenized by lexer rules.' It also explicitly distinguishes itself from the sibling tool test-parser-rule, stating it tests parser rules without full lexer simulation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
A dedicated 'When to use' section lists concrete scenarios such as testing rule matches, debugging tokenization, verifying grammar changes, and learning ANTLR4. It also provides an explicit alternative: 'For complex grammars, use test-parser-rule.'
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
profile-parsingA
Profile grammar parsing with detailed performance metrics.
When to use: Deep performance analysis, debugging slow parsing, optimizing grammars.
Measures:
Parse time (ms)
Token count
Parse tree depth
Decision evaluations (ATN transitions)
Ambiguity count (conflicting alternatives)
Context sensitivity (SLL→LL fallbacks)
Rule invocation frequency
Parameters:
grammar_files: Object mapping filename to content
start_rule: Parser rule to start from
input: Sample input text
Returns:
Detailed profile metrics
Most frequently invoked rules
Optimization suggestions
Example: grammar_files: {"Expr.g4": "grammar Expr; ..."} start_rule: "program" input: "x = 1 + 2 * 3"
Interpretation:
ambiguityCount > 0: Grammar has ambiguous alternatives
contextSensitivityCount > 10: Many SLL→LL fallbacks (slow)
treeDepth > 100: Excessive nesting
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Input text to parse | |
| start_rule | Yes | Parser rule to start parsing from | |
| grammar_files | Yes | Map of filename to grammar content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It adds rich context through the 'Measures' and 'Interpretation' sections, explaining exactly what gets analyzed and how to interpret the results (e.g., ambiguityCount > 0 means ambiguous alternatives). It doesn't mention side effects or permissions, but the profiling nature is clear and the description goes beyond a bare 'Profile parsing' statement.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections (When to use, Measures, Parameters, Returns, Example, Interpretation). Every section provides necessary information, and the content is front-loaded with the core purpose. No redundant or filler sentences.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (3 params, no output schema, no annotations), the description is very complete. It explains the return values explicitly (profile metrics, frequent rules, optimization suggestions) and provides interpretation thresholds for key metrics, which is critical for an AI agent to understand the output without a schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so baseline is 3. The description restates the parameters with concise meanings and adds a concrete example showing expected values for grammar_files, start_rule, and input. This example adds practical meaning beyond the schema definitions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action: 'Profile grammar parsing with detailed performance metrics.' It clearly identifies the resource (grammar parsing) and the goal (performance analysis), and distinguishes itself from sibling tools by listing concrete measures like parse time, ambiguity count, and context sensitivity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'When to use' section explicitly says 'Deep performance analysis, debugging slow parsing, optimizing grammars,' providing clear context for when to invoke this tool. However, it doesn't explicitly mention when not to use it or name alternative tools, so it stops short of full exclusionary guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
remove-ruleA
Remove a rule cleanly from an ANTLR4 grammar.
When to use: Delete obsolete rules, clean up unused definitions, or refactor grammar structure.
Example usage: rule_name: "oldExpression" write_to_file: true
Warning: Does not update references to this rule in other rules. Use find-rule-usages first to check impact.
Returns: Modified grammar with rule removed, success message, file write confirmation if applicable.
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| rule_name | Yes | Name of the rule to remove (case-sensitive) | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of disclosing side effects. It warns that 'Does not update references to this rule in other rules,' which is a critical behavioral trait. It also mentions the return value (modified grammar, success message, file write confirmation). However, it doesn't address edge cases like missing rule or error handling, so a 4 is appropriate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and appropriately sized. It opens with a clear one-sentence summary, then uses compact sections (When to use, Example usage, Warning, Returns) that each add value without redundancy. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite no output schema and no annotations, the description covers purpose, usage scenarios, a critical warning, an example, and return values. The 4-parameter tool is fully understandable for an agent to select and invoke correctly. The description is complete for its complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so parameters (rule_name, from_file, write_to_file, grammar_content) are already well-documented. The description adds a small example (rule_name: 'oldExpression', write_to_file: true) but no significant extra meaning beyond the schema. It does reinforce the dependency between write_to_file and from_file, but that is already in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Remove a rule cleanly from an ANTLR4 grammar.' The verb 'Remove' and specific resource 'rule from ANTLR4 grammar' make it unambiguous, and it is easily distinguished from sibling tools like rename-rule or update-rule.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicit 'When to use' section lists concrete scenarios: 'Delete obsolete rules, clean up unused definitions, or refactor grammar structure.' It also provides an exclusion/alternative: 'Does not update references... Use find-rule-usages first to check impact.' This gives clear guidance on appropriate use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
rename-ruleA
Safely rename a rule and automatically update ALL references throughout the grammar.
When to use: Refactor rule names for clarity, fix naming conventions, or improve code readability.
Example usage: old_name: "expr" new_name: "expression" write_to_file: true
Multi-file example: from_file: "MyGrammar.g4" base_path: "/path/to/grammars" load_imports: true write_to_file: true
Features:
Uses whole-word matching (prevents "expr" from matching "subexpr")
Updates rule definition and ALL references in other rules
Preserves rule position in grammar
Reports number of references updated
Multi-file support: Set load_imports=true to rename across imported grammars
Recommended workflow:
find-rule-usages with load_imports=true to see full impact
rename-rule with load_imports=true to perform refactoring
validate-grammar to verify correctness
Returns: Modified grammar with rule and all references renamed, update count, file write confirmation if applicable.
| Name | Required | Description | Default |
|---|---|---|---|
| new_name | Yes | New name for the rule (must follow ANTLR4 naming: uppercase for lexer, lowercase for parser) | |
| old_name | Yes | Current name of the rule (case-sensitive) | |
| base_path | No | Optional: base directory for resolving imports. Required for multi-file grammars. | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file or load_imports. | |
| output_mode | No | Output format: "full" returns entire modified grammar, "diff" returns git-style unified diff (default for modification tools), "none" returns no content (useful for write-only operations) | |
| load_imports | No | If true, loads all imported grammar files and renames the rule across all files. Requires from_file to be set. | |
| write_to_file | No | If true, writes modified grammar back to from_file (and all imported files if load_imports is true) | |
| grammar_content | No | The ANTLR4 grammar file content (ignored if from_file and load_imports are set) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description takes on full responsibility for disclosing side effects. It details whole-word matching, updating all references, preserving rule position, reporting update count, and supporting multi-file modification via load_imports. It also clarifies the write_to_file behavior and return value, giving a thorough picture of the tool's impact.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections (purpose, when to use, examples, features, workflow, returns) and is front-loaded with the core purpose. However, there is minor redundancy: the opening statement that all references are updated is repeated in the features list. Overall, it is efficient and earns its length.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (8 parameters, multi-file support, file writing), the description is highly complete. It covers use cases, provides examples, outlines a workflow, lists features, and describes return values. The absence of an output schema is compensated by explicitly stating what the tool returns. Error scenarios are not mentioned, but that is not required for this level of completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds usage examples (e.g., old_name/new_name combos, multi-file parameters) that illustrate parameter interplay but does not reveal new semantics beyond the schema. It does not compensate for missing parameter details because none are missing.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The opening sentence clearly states the tool's purpose: 'Safely rename a rule and automatically update ALL references throughout the grammar.' This specifies the verb (rename), resource (rule), and scope (all references), distinguishing it from sibling tools like update-rule or remove-rule. The 'When to use' section further clarifies its role in refactoring.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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 and a recommended workflow that involves find-rule-usages and validate-grammar, giving clear context for usage. However, it does not explicitly state when not to use the tool or directly compare it to alternatives like update-rule, so it falls just short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
rule-statisticsA
Analyze rule complexity, dependencies, and performance characteristics.
When to use: Understand rule complexity, identify bottlenecks, find heavily-used rules, plan refactoring.
Example usage: rule_name: "expression"
Returns:
Rule definition and type
Complexity metrics: number of alternatives
Fan-out: rules that this rule references (dependencies)
Fan-in: rules that reference this rule (dependents)
Recursion analysis: direct/indirect recursion detection
Usage statistics
Use cases:
Identify complex rules for optimization
Find highly-coupled rules
Detect recursion issues
Plan refactoring priorities
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read | |
| rule_name | Yes | The name of the rule to analyze (case-sensitive) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description is detailed about what the tool returns (rule definition, complexity metrics, fan-out/fan-in, recursion analysis, usage statistics) and includes an example usage. There are no annotations, so the description carries the burden, and it effectively discloses the analytical behavior, though it does not explicitly state read-only semantics or error conditions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with clear sections (intro, when to use, example, returns, use cases) and front-loaded with the primary purpose. It is slightly redundant (returns and use cases overlap), but each section earns its place and the length is appropriate for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
There is no output schema, so the description compensates by explicitly listing return categories (complexity metrics, fan-out, fan-in, recursion analysis, usage statistics). It covers use cases and example input, making the tool understandable. Minor gaps include lack of error-handling details and explicit read-only confirmation, but overall it is complete for an analysis tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema provides 100% coverage for all parameters, including descriptions for rule_name, from_file, and grammar_content. The description adds one example usage ('rule_name: "expression"') but does not enrich the parameter meanings beyond what the schema already offers, so baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool analyzes rule complexity, dependencies, and performance characteristics for specific rules. It distinguishes from sibling tools like grammar-metrics or analyze-grammar by focusing on individual rule analysis with specific outputs like fan-in/fan-out and recursion detection.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides a clear 'When to use' section listing concrete scenarios (understand complexity, identify bottlenecks, find heavily-used rules, plan refactoring). It gives clear context for when to apply the tool, though it does not explicitly mention when not to use it or name alternative tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
smart-validateA
Smart grammar validation with aggregated, actionable insights.
When to use: When validate-grammar returns too many issues and you need to see patterns, not individual warnings.
Improvements over basic validation:
Groups similar issues (e.g., 15,000 undefined refs → "9 missing tokens")
Prioritizes by impact (most-referenced undefined tokens first)
Suggests specific fixes with reasoning
Detects anti-patterns (null_rest_of_line usage)
Flags suspicious quantifiers (? that should be *)
Example output: Summary: 17,234 issues
Undefined tokens (15,890 refs, 9 unique) → Add ADDRESS_REGEX (89 refs), EVENT_TYPE (67 refs), ...
Suspicious quantifiers (8 rules) → bgpp_export: bgp_policy_rule? should be *
Incomplete parsing (3 rules) → ss_ssl_tls_service_profile uses null_rest_of_line
Parameters:
include_suggestions: Generate smart token suggestions
detect_quantifiers: Flag suspicious ? patterns
detect_incomplete: Flag null_rest_of_line usage
Returns: Aggregated summary, grouped issues, and actionable recommendations.
| Name | Required | Description | Default |
|---|---|---|---|
| base_path | No | Optional: base directory for resolving imports | |
| from_file | No | Optional: path to a grammar file to read | |
| load_imports | No | Optional: if true, automatically load imported grammars. Default: true. | |
| grammar_content | No | The ANTLR4 grammar file content | |
| detect_incomplete | No | Detect incomplete parsing patterns (default: true) | |
| detect_quantifiers | No | Detect suspicious quantifier patterns (default: true) | |
| include_suggestions | No | Generate smart suggestions for missing tokens (default: true) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description discloses several behavioral traits: it groups similar issues, prioritizes by impact, suggests fixes, detects anti-patterns, and flags suspicious quantifiers. It includes an example output to illustrate the aggregation format. However, it does not explicitly state whether the operation is read-only or has side effects, but the context strongly implies it is a non-mutating analysis (no annotations are provided).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections: opening statement, when to use, improvements list, example output, parameters, and returns. Every sentence contributes meaningful information, and the formatting makes it easy to scan. It is appropriately sized for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is unusually complete: it gives usage context, differentiates from sibling tools, lists capabilities, shows a sample output, and summarizes the return value. Given there is no output schema and no annotations, the description effectively conveys what the tool does and what to expect. It also covers the key parameters that influence behavior.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds value by contextualizing the three boolean flags (include_suggestions, detect_quantifiers, detect_incomplete) in relation to the overall aggregation features, such as linking include_suggestions to 'suggests specific fixes with reasoning.' It does not repeat all schema fields, focusing only on those that drive the tool's unique behavior.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool performs 'Smart grammar validation with aggregated, actionable insights' and immediately distinguishes it from validate-grammar by focusing on pattern detection rather than individual warnings. It enumerates specific capabilities (grouping, prioritization, suggestions, anti-pattern detection) that go beyond basic validation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit when-to-use guidance: 'When validate-grammar returns too many issues and you need to see patterns, not individual warnings.' This names the alternative tool and gives clear context. The 'Improvements over basic validation' section further clarifies the tool's role versus simpler validation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sort-rulesA
Reorder rules in a grammar according to various sorting strategies.
When to use:
Clean up messy grammar files
Organize rules logically
Improve readability and maintenance
Group related rules together
Sorting Strategies:
alphabetical (default)
Sorts parser rules alphabetically
Then sorts lexer rules alphabetically
Most common for general organization
type
Groups by rule type
parser_first: true (default) - parser rules first
parser_first: false - lexer rules first
dependency
Orders rules based on relationship to anchor rule
Requires anchor_rule option
Order: dependencies → anchor → dependents → rest
Useful for understanding rule relationships
usage
Most-referenced rules first
Helps identify "core" rules
Useful for understanding grammar structure
Example - Alphabetical: strategy: "alphabetical"
Example - Dependency-based: strategy: "dependency" anchor_rule: "expression"
Example - Type-based: strategy: "type" parser_first: false // Lexer rules first
Features:
Preserves multi-line rule formatting
Maintains blank lines after rules
Preserves header (grammar declaration, imports, options)
Handles all rule types (parser, lexer, fragment)
Returns:
Reordered grammar
Statistics (total rules, strategy used)
| Name | Required | Description | Default |
|---|---|---|---|
| strategy | No | Sorting strategy: alphabetical (default), type, dependency, or usage | |
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| anchor_rule | No | For dependency strategy: the rule to use as anchor (rules used by this rule come first) | |
| parser_first | No | For type strategy: if true (default), parser rules come before lexer rules | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full transparency burden. It discloses key behaviors: preserves multi-line rule formatting, maintains blank lines after rules, preserves the header, and handles all rule types. It also explains that it returns reordered grammar and statistics. It doesn't mention error handling or side effects of write_to_file, but the coverage is strong.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear headings, bullet points, and examples. It front-loads the core purpose, then logically separates usage, strategies, features, and return values. Every section provides necessary detail without redundancies, making it easy for an agent to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (six parameters, four sorting strategies), the description covers all essential aspects: when to use, strategy details with examples, formatting preservation features, and return values. No output schema exists, but the description explicitly states what is returned. This is comprehensive for an AI agent to invoke correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so baseline is 3. The description enhances this by explaining each strategy in detail with examples, including how anchor_rule and parser_first affect behavior. This adds semantic clarity beyond the schema's short field descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb+resource: 'Reorder rules in a grammar according to various sorting strategies.' It clearly distinguishes this tool from siblings like format-grammar (formatting whitespace) and list-rules (listing) by focusing on reordering logic. The detailed strategies further refine the scope.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
A dedicated 'When to use' section lists concrete scenarios (clean up messy files, organize rules logically, improve readability, group related rules). It provides clear context for when to employ this tool, though it does not explicitly mention alternatives or exclusion cases, which would push it to a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
suggest-tokens-from-errorsA
Parse error logs and automatically suggest missing tokens to add to grammar.
When to use:
Debugging parser failures with error logs
Identifying missing tokens from Batfish errors
Analyzing ANTLR parse error output
Incremental grammar development based on test failures
Supported error log formats:
Batfish-style: "unexpected token: 'word'"
ANTLR-style: "mismatched input 'word'"
ANTLR-style: "no viable alternative at input 'word'"
Generic: any quoted strings in error context
Example - Analyze Batfish error log: error_log: "Error parsing config: unexpected token: 'ftm-push' at line 10" → Suggests: FTM_PUSH token with pattern 'ftm-push'
Example - Parse ANTLR errors: error_log: "line 5:10 mismatched input 'admin' expecting {CONFIG, SYSTEM}" → Suggests: ADMIN token with pattern 'admin'
Features:
Multi-format error log parsing
Confidence scoring (high/medium/low)
Automatic deduplication
Skips tokens that already exist in grammar
Provides reasoning for each suggestion
Handles multiple errors in batch
Returns:
List of suggested tokens with:
Token name (uppercase with underscores)
Pattern (string literal)
Reason for suggestion
Confidence level
Summary of suggestions found
Note: This tool only suggests tokens. Use add-lexer-rules to actually add them to your grammar.
| Name | Required | Description | Default |
|---|---|---|---|
| error_log | Yes | Error log content to analyze (supports Batfish and ANTLR error formats) | |
| from_file | No | Optional: path to a grammar file to read | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description takes full burden and does an excellent job: it explains supported error formats, deduplication, skipping existing tokens, confidence scoring, and the fact that it makes no changes to the grammar. The 'Note' reinforces its non-mutating nature.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Although long, the description is well-structured with headers, bullet points, and examples. Every section contributes useful information, and key points like 'only suggests tokens' are front-loaded. No wasted sentences.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the tool's purpose, supported formats, examples, output structure, and limitations. Given the lack of an output schema, it adequately describes return values and next steps, leaving no major gaps for the user.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 by giving concrete examples of error_log formats and the expected behavior, which enriches the skeletal schema descriptions and helps users craft valid input.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool parses error logs and suggests missing tokens for the grammar. It distinguishes itself from sibling tools by explicitly noting it only suggests tokens and directs users to add-lexer-rules for actual modifications.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Includes a dedicated 'When to use' section listing concrete scenarios like debugging parser failures and analyzing ANTLR errors. It also differentiates from the alternative tool, providing clear guidance on when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
test-parser-ruleA
Test if input text matches a specific parser rule. Now with native ANTLR4 support!
🚀 Native ANTLR4 Support: Automatically uses native ANTLR4 runtime if available for 100% accurate parsing including:
✅ Lexer modes (pushMode, popMode)
✅ Semantic predicates ({...?})
✅ Actions ({...})
✅ All complex parser patterns
✅ Multi-file grammars with imports
Falls back to simulation if ANTLR4 is not installed.
When to use:
Rapid iteration on rule syntax during development
Verify if text matches a parser rule structure
Test rules with complex features (modes, predicates)
Test rules that reference imported tokens/rules
Debug parsing issues in complex grammars
Setup for 100% accuracy (optional):
Install Java: brew install openjdk
Install ANTLR4: wget https://www.antlr.org/download/antlr-4.13.1-complete.jar
Set env: export ANTLR4_JAR=/path/to/antlr-4.13.1-complete.jar
How it works:
Native mode: Compiles and executes actual ANTLR4 parser (100% accurate)
Simulation mode: Best-effort matching (~70-90% accuracy)
Example - Test expression rule: rule_name: "expression" input: "x + y * 2"
Example - Test with multi-file grammar: from_file: "/path/to/MyParser.g4" base_path: "/path/to/grammar/dir" load_imports: true rule_name: "expression" input: "x + y"
Example - Show parse tree: rule_name: "statement" input: "if (x) y = 1;" show_tree: true
Returns:
Match result (✅ matches or ❌ doesn't match)
Parse tree (if show_tree enabled)
Parse errors with line/column information
Mode indicator (🚀 Native or ⚠️ Simulation)
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Input text to test against the rule | |
| base_path | No | Optional: base directory for resolving imports and tokenVocab. Required for multi-file grammars. | |
| from_file | No | Optional: path to a grammar file to read | |
| rule_name | Yes | Name of the parser rule to test (e.g., "expression", "statement") | |
| show_tree | No | Optional: if true, displays the parse tree (native mode only). Default: false. | |
| load_imports | No | Optional: if true, automatically load imported grammars and lexer vocabulary. Default: true. | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description fully carries the transparency burden. It discloses the native ANTLR4 vs. simulation fallback, accuracy differences (100% vs. 70-90%), optional setup requirements (Java, ANTLR4 jar), and the return payload (match result, parse tree, errors, mode indicator). This goes well beyond the schema and gives the agent critical behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is longer than average, but it is well-structured with headings, bullet points, and examples. The main purpose is front-loaded. Some content, like the setup instructions and feature list, could be trimmed or moved to a help page, but given the tool's complexity, the length is mostly justified and scannable.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the tool's purpose, usage scenarios, mode behavior, setup, examples, and return values. It is nearly complete for a tool with 7 parameters and no output schema. However, it does not clarify where the grammar comes from when neither from_file nor grammar_content is provided—it only shows usage with rule_name/input alone, implying a default grammar context that is not explicitly explained.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds value by including examples that show how parameters like from_file, base_path, load_imports, and show_tree work together in realistic scenarios, such as multi-file grammars. While it does not elaborate on grammar_content beyond the schema, the examples clarify parameter relationships and edge cases.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a clear, specific statement: 'Test if input text matches a specific parser rule.' This uses a precise verb+resource structure and immediately distinguishes the tool from siblings like validate-grammar or compile-grammar. The rest of the description reinforces this purpose with detailed feature explanations and examples.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
An explicit 'When to use:' section lists concrete scenarios such as rapid iteration, verifying text structure, and testing complex features like modes or predicates. It also explains the native vs. simulation mode tradeoff, which helps set expectations. However, it does not explicitly mention when NOT to use this tool or name alternative sibling tools, so it stops short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
update-ruleA
Update an existing rule definition in place. Now supports multi-line definitions!
When to use: Modify rule logic, add alternatives, refine patterns, or fix issues.
Example - Simple update: rule_name: "expression" new_definition: "term ((PLUS | MINUS) term)*"
Example - Multi-line update (string with \n): rule_name: "srp_uuid_null" new_definition: "UUID\n | ~(\n ACTION\n | FROM\n )"
Example - Multi-line update (JSON array): rule_name: "srp_uuid_null" new_definition: ["UUID", " | ~(", " ACTION", " | FROM", " )"]
Multi-line support:
Pass a string with embedded \n characters, OR
Pass an array of strings (one per line) - more readable!
Formatting is automatically preserved based on grammar style
Preserves rule position in grammar. Use rename-rule if changing the rule name.
Returns: Modified grammar with rule updated, success message, file write confirmation if applicable.
| Name | Required | Description | Default |
|---|---|---|---|
| from_file | No | Optional: path to a grammar file to read. Required if using write_to_file. | |
| rule_name | Yes | Name of the rule to update (case-sensitive) | |
| output_mode | No | Output format: "full" returns entire modified grammar, "diff" returns git-style unified diff (default for modification tools), "none" returns no content (useful for write-only operations) | |
| write_to_file | No | If true, writes modified grammar back to from_file (requires from_file to be set) | |
| new_definition | Yes | The new rule definition to replace the existing one | |
| grammar_content | No | The ANTLR4 grammar file content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It discloses multi-line support, preservation of rule position, return values, and optional file writing. However, it does not explicitly state potential side effects like whether the input grammar is modified in memory or file, or if validation is performed, leaving minor gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections and examples, but it is longer than necessary. While the examples are helpful, they add length; the core message could be condensed. Still, the front-loaded first sentence states the primary purpose effectively, and the overall structure earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (6 parameters, no output schema, no annotations), the description covers key aspects: behavior, multi-line handling, return values, and file writing. However, it does not mention how the grammar content is specified (from_file vs grammar_content) in the examples, which is a notable omission for a tool that modifies grammar. The schema covers this, but the description could be more complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already covers all parameters (100% coverage), so the baseline is 3. The description adds meaningful semantics by explaining the new_definition parameter supports both strings with \n and arrays of strings, which is beyond the schema's type declaration. It also clarifies the relationship between from_file and write_to_file. However, the array example contradicts the schema's 'string' type for new_definition, which could confuse an agent.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: updating an existing rule definition. It includes a specific verb ('update'), the resource ('rule definition'), and explicitly differentiates from rename-rule, which is a sibling tool. The phrase 'in place' and preserving rule position adds clarity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states when to use it ('Modify rule logic, add alternatives, refine patterns, or fix issues') and refers to rename-rule as the alternative when changing the rule name. This direct guidance helps an agent choose between siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate-grammarA
Validate ANTLR4 grammar syntax and detect common issues.
When to use: After making changes to verify correctness, or to diagnose problems in an existing grammar.
Example usage: from_file: "MyGrammar.g4"
Detects:
Undefined rule references (rules used but not defined)
Unused rules (defined but never referenced)
Direct left recursion issues
Fragment rule misuse
Naming convention violations
Returns: List of issues with severity (error/warning/info), descriptions, line numbers, and affected rule names.
| Name | Required | Description | Default |
|---|---|---|---|
| base_path | No | Optional: base directory for resolving imports and tokenVocab. Required for multi-file grammars. | |
| from_file | No | Optional: path to a grammar file to read | |
| max_issues | No | Optional: maximum number of issues to return. Default: 100. Use 0 for unlimited. | |
| load_imports | No | Optional: if true, automatically load imported grammars and lexer vocabulary. Default: true. | |
| grammar_content | No | The content of the ANTLR4 grammar file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description takes on the full burden of behavioral disclosure. It transparently lists the types of issues detected (undefined rules, unused rules, left recursion, fragment misuse, naming issues) and the return format (severity, descriptions, line numbers, rule names). The read-only nature of validation is implied, though not explicitly stated, but the disclosure is sufficient for safe operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections ('When to use', example, detected issues, return format) and uses bullet points for readability. It is slightly longer than necessary but every part contributes to understanding, with no repetitive or filler content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of an output schema, the description compensates by describing the return value (list of issues with severity, line numbers, etc.). It covers usage context, an example, and detailed detection categories. However, it does not elaborate on how parameters interact (e.g., whether grammar_content and from_file are mutually exclusive) or when base_path becomes necessary beyond a single mention. For a 5-parameter tool, this is solid but not exhaustive.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% per context signals, so the baseline is 3. The description adds minimal parameter-specific meaning beyond the schema; it shows an example using from_file but does not explain relationships or trade-offs between grammar_content, from_file, and base_path. The schema descriptions themselves already document each parameter, so the description adds little extra value.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool 'Validates ANTLR4 grammar syntax and detect common issues', pairing a specific verb with a concrete resource. It distinguishes itself from siblings like compile-grammar and analyze-grammar by enumerating the exact validation checks performed (undefined rules, unused rules, left recursion, etc.).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description includes an explicit 'When to use' section, recommending use after changes or for diagnosing problems in existing grammars. While it gives clear context, it does not mention when to avoid this tool or explicitly compare against sibling tools like analyze-grammar or smart-validate, missing the 'when not to use' part for a top score.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
visualize-parse-treeA
Visualize the parse tree structure for a given input.
When to use: Understanding parse results, debugging grammar structure, documentation.
Output formats:
ascii: Text-based tree with indentation (default)
json: Structured JSON tree representation
lisp: S-expression style (rule child1 child2 ...)
Parameters:
grammar_files: Object mapping filename to content
start_rule: Parser rule to start from
input: Sample input text
format: Output format (ascii, json, lisp)
Example: grammar_files: {"Expr.g4": "grammar Expr; ..."} start_rule: "expr" input: "1 + 2 * 3" format: "ascii"
Returns: ASCII example:
expr
├── term
│ └── factor
│ └── NUMBER '1'
├── PLUS '+'
└── term
├── factor
│ └── NUMBER '2'
├── TIMES '*'
└── factor
└── NUMBER '3'| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Input text to parse | |
| format | No | Output format (default: ascii) | |
| start_rule | Yes | Parser rule to start parsing from | |
| grammar_files | Yes | Map of filename to grammar content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It details output formats, defaults, and provides a return example, giving agents a clear picture of tool behavior. It does not cover error handling or edge cases, but for a read-only visualization tool, the disclosure is adequate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections, but it redundantly repeats parameter information already present in the schema. The example is valuable and front-loaded, making the description easy to scan despite its length.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description provides comprehensive information: purpose, when to use, parameters, example, and return format. Despite no output schema, the return example gives a concrete representation of the expected output, making the tool fully usable for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the schema documents all parameters. The description adds value by clarifying the default format ('ascii') and providing a concrete example mapping parameters to values. The example helps agents understand how to construct input.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function with a specific verb ('Visualize') and resource ('parse tree structure'). It distinguishes itself from sibling grammar tools by focusing on visual output of parse trees for given input.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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 specific use cases: understanding parse results, debugging grammar structure, and documentation. It does not explicitly mention alternatives or when not to use, 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.
TDQS
With 55 tools, there is significant overlap in purpose. Multiple analysis tools (analyze-grammar, analyze-ambiguities, analyze-lexer-modes, analyze-mode-transitions, analyze-bottlenecks, grammar-metrics) and validation tools (validate-grammar, compile-grammar, smart-validate, check-style) cover similar ground, making it difficult for an agent to select the most appropriate one. Despite detailed descriptions, boundaries between many tools are blurry.
The naming pattern is predominantly lowercase with hyphen-separated words, typically verb_noun (e.g., list-rules, update-rule, analyze-grammar). This is consistent and predictable. Minor deviations include 'help' (no verb) and 'add-lexer-rules-removed' which appears to be a misnamed tool, and singular/plural variants like add-rule vs add-rules.
At 55 tools, this server is well beyond the typical well-scoped MCP server range (3-15 tools). The sheer number creates navigation and selection overhead, and many tools could be consolidated. The extreme count suggests a lack of focused curation.
The server covers the full grammar lifecycle: creation, reading, updating, deleting rules, validation, analysis, testing, benchmarking, and documentation. Minor gaps exist (e.g., no dedicated tool for deleting a mode, no direct grammar option editing), but overall the surface is very thorough for the ANTLR4 domain.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives Claude Desktop complete intelligence about any public GitHub repository. Research libraries, compare packages, audit dependencies, and explore codebases through natural conversation.1MIT
- FlicenseAqualityDmaintenanceAn MCP server that gives Claude IDE capabilities inside VS Code and Cursor, enabling file operations, shell commands, and workspace management via natural language.12
- AlicenseNot gradedqualityDmaintenanceMCP server that integrates Ghidra for binary analysis, enabling decompilation, disassembly, and advanced reverse engineering tasks through Claude Code.15MIT
- AlicenseNot gradedqualityFmaintenanceAn MCP server that allows Claude Code to interact with the OpenAI Codex CLI.2921MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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