Skip to main content
Glama

validate_grammar

Validate a serialized GrammarSpec. Structural validation against the bundled grammar schema, an engine load in a fresh instance, and a check that every rule reference (p, r) names a rule the grammar actually defines — a dangling reference loads cleanly and then fails at parse time with unknown_rule. Returns {ok:true, v} (v = declared builtin config-schema version, absent means 1) or {ok:false, errors:[{path,message}]}. Security: a grammar carrying a ref key, or any function reference that is not a $-suffixed engine builtin, is rejected — validating a grammar never runs supplied code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
grammarYesSerialized GrammarSpec (pure JSON, no functions). Schema: resource tabnas://schema/grammar. Grammars are validated before use; a `ref` key or a non-builtin function reference is rejected.

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations, the description carries full disclosure: it details the validation process, return format (both success and error), handling of dangling references, and explicitly states that `ref` keys and non-builtin function references are rejected, and that validating never runs supplied code. This is highly transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is structured in three sentences, each dense with distinct information (validation steps, return format, security). It is slightly long but every clause adds value, and the main purpose is front-loaded.

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

Completeness5/5

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

Given the absence of an output schema, the description fully explains return values (`{ok:true, v}` and `{ok:false, errors}`) and the security model. It covers all critical aspects of validation behavior, making it complete for an agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The single parameter 'grammar' is fully described in the schema (100% coverage), including its type and rejection of `ref`. The description adds detail about the validation process but not new meaning about the parameter itself, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly specifies the verb 'validate' and the resource 'serialized GrammarSpec', and outlines the three validation steps (structural, engine load, rule-reference check). It is distinct from siblings like compare_grammars, test_grammar, and parse, which perform different functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage as a pre-use validation step ('Grammars are validated before use') and mentions a security warning, but does not explicitly state when to prefer this over siblings like test_grammar or compare_grammars. Context is present but not prescriptive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.2/5.0
Disambiguation4/5

Each tool has a clearly distinct task: parse returns the tree, explain_parse_error returns diagnostics with registry entries, and the grammar-focused tools target validation, fixture testing, and compatibility. The only mild overlap is between parse and explain_parse_error, but their descriptions and return contracts make the boundary clear.

Naming Consistency5/5

All tools follow a consistent verb_noun snake_case pattern: validate_grammar, test_grammar, compare_grammars, list_plugins, describe_plugin, explain_parse_error. parse is a bare verb but fits the imperative style and does not conflict with any other name.

Tool Count5/5

Seven tools cover parsing, grammar validation, fixture testing, grammar comparison, error explanation, and plugin introspection without redundancy. This is a well-scoped set for a developer-facing grammar toolchain.

Completeness5/5

The surface covers the core workflows: parse input, validate grammars, test against fixtures, compare grammars, explain parse errors, and inspect plugin descriptors. There are no obvious dead ends, and grammar mutation or plugin installation is outside the apparent read-only/analysis scope.