Mustache template validate
mustache-template-validate · version 1.0.0 · Developer tools · free, no key needed
Check Mustache template syntax (spec v1.4.2) and its partials; returns valid or the first error with line and column.
Use when you need to: validate mustache template syntax · check a mustache template for errors · find an unclosed mustache section.
Decide before calling
Read the versioned contract and the supported scope below. Reuse mustache-template-validate@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use mustache-template-validate@1.0.0 for validate mustache template syntax. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- validate mustache template syntax
- check a mustache template for errors
- find an unclosed mustache section
- lint mustache tags and delimiters
- mustache syntax checker with line and column
- is this mustache template well formed
Not supported
- checking whether data contains every referenced key (use mustache-variables-list)
- rendering the template (use mustache-template-render)
- validating Handlebars, Jinja or Liquid syntax
- accepting inheritance or dynamic-name extensions
Behavior
- Grammar of Mustache specification v1.4.2: tags open with the current opening delimiter ({{ by default); sigils ! # ^ / > & { and = select comment, section, inverted section, close, partial, unescaped, triple mustache and set-delimiter tags.
- Names are "." or non-empty dot-separated parts with no ASCII whitespace after trimming padding; partial names are any non-empty run without ASCII whitespace.
- A set-delimiter tag must contain exactly two whitespace-separated delimiters, neither containing "="; otherwise reason invalid_delimiter_change.
- Reasons: unclosed_tag, invalid_tag_name, invalid_delimiter_change, unexpected_section_close, mismatched_section_close (names compared exactly), unclosed_section (the outermost still-open section), unsupported_tag ({{$...}}, {{<...}}, {{>*...}}).
- The template is checked first, then each partial in code-unit order of its name with default delimiters; the first error is reported with partial (null for the template), line and column (1-based, column in code points at the opening delimiter).
- A missing partial or missing data key is not a syntax error.
Input
template(string, required): max length 65536; Mustache template text (at most 65536 UTF-8 bytes).partials(object, optional): Optional map from partial name to template text; each is validated. Omitted means none.
Output
valid(boolean, required)reason(one of "unclosed_tag", "invalid_tag_name", "invalid_delimiter_change", "unexpected_section_close", "mismatched_section_close", "unclosed_section", "unsupported_tag", null, required)partial(string or null, required)line(integer or null, required): min 1column(integer or null, required): min 1
Limits
- max template bytes: 65536
- max partials: 32
- max tags: 10000
- max section depth: 32
Example
Request input:
{
"template": "Hello, {{name}}!"
}
Response:
{
"result": {
"valid": true,
"reason": null,
"partial": null,
"line": null,
"column": null
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "mustache-template-validate",
"version": "1.0.0",
"input": {
"template": "Hello, {{name}}!"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/mustache-template-validate/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"template":"Hello, {{name}}!"}'
The machine-readable contract is at /v1/tools/mustache-template-validate/versions/1.0.0.
CLI
node cli.mjs run mustache-template-validate 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Mustache template render: Render a logic-less Mustache template (spec v1.4.2) with JSON data and inline partials; returns the exact text.
- Mustache variables list: List the names and partials a Mustache template references, with tag kind, line, column and enclosing sections.
- Shell argv quote: Quote inert argv strings for POSIX sh or PowerShell 7, returning a command and its per-argument fragments.
- Git renames detect: Detect deterministic one-to-one Git-style rename pairs, unmatched paths, scores, and byte evidence.
- Openapi operation extract: Extract one OpenAPI operation, merge inherited parameters, and return its local component-reference closure.
- Commit conventional parse: Parse one Conventional Commits 1.0.0 message into its header, body, footers, and breaking-change status.