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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "grammar": "<grammar>"
    },
    "name": "validate_grammar"
  }
}

Input 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

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.