Skip to main content
Glama

Render a Jinja2 template

services_render_template
Read-onlyIdempotent

Render a Jinja2 template string through Home Assistant's template engine to preview its output before saving it into an automation, script, or template sensor.

Instructions

Render a Jinja2 template string once through HA's template engine over HTTP.

Posts to /api/template with {"template": template} and returns the rendered text.

Use when: testing a template's output before saving it into an automation, script or template sensor. Not for: rendering through the WebSocket subscription transport — use ws_render_template. Returns: the rendered template as plain text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateYesJinja2 template string to render, e.g. '{{ states("sensor.temp") }}'.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.25.1
    • addedInput schema / properties / template / description
      Added value: +"Jinja2 template string to render, e.g. '{{ states(\"sensor.temp\") }}'."
  2. First observedv0.3.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description adds material context beyond that: the HTTP transport, the exact endpoint and request payload shape, and the return type ('rendered template as plain text'). It doesn't cover failure behavior (e.g., render errors in the template), but this is solid added value.

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

Conciseness5/5

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

Front-loaded one-line purpose, then transport detail, then Use when / Not for / Returns. Every sentence earns its place; no filler.

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?

An output schema exists, so return values needn't be explained, yet the description still names the plain-text return. For a single-parameter read tool, the purpose, transport, endpoint, usage conditions and the sibling exclusion are all present.

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

Parameters3/5

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

Schema coverage is 100% and the single parameter already documents the Jinja2 syntax with an example. The description's payload mention ('{ "template": template }') restates the schema rather than adding new meaning. Baseline 3 applies when the schema does the heavy lifting.

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?

States a specific verb+resource (render a Jinja2 template) and adds the crucial transport qualifier: 'once through HA's template engine over HTTP', posting to `/api/template`. This precisely distinguishes it from the sibling ws_render_template, which it names explicitly.

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

Usage Guidelines5/5

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

Explicit 'Use when: testing a template's output before saving it into an automation, script or template sensor' plus an explicit 'Not for:' exclusion routing to ws_render_template. Both the when and the when-not are stated with the alternative named.

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

Deploy Server

Other Tools