Skip to main content
Glama

Render a Jinja template

ha_render_template
Read-onlyIdempotent

Render a Home Assistant Jinja2 template on the server to read or compute multiple entity values at once. Returns the rendered string for state-based calculations.

Instructions

Render a Home Assistant Jinja2 template server-side. Args: template, variables (optional). The cheapest way to read or compute many values at once, e.g. "{{ states('sensor.kitchen_temperature') }}" or "{% for s in states.light %}{{ s.entity_id }}: {{ s.state }}\n{% endfor %}". Returns: the rendered string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateYesJinja2 template
variablesNoVariables available to the template

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, so the safety profile is covered structurally. The description adds 'server-side' execution and the return shape ('the rendered string'), but says nothing about template evaluation cost limits, error behavior on invalid templates, or which HA objects are reachable. Useful additions, but modest against an already-complete annotation set.

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-loads the purpose, then args, then the comparative usage advantage, then examples, then the return. Every line carries information and there is no filler or repetition.

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

Completeness4/5

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

With no output schema, the description correctly compensates by stating 'Returns: the rendered string' and demonstrating template syntax. What is missing is failure behavior (invalid template, unknown entity) and any note on template scope, but the core call information is 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 description coverage is 100% ('Jinja2 template', 'Variables available to the template'), so the schema already documents both parameters. The description's 'Args: template, variables (optional)' restates that, including the optionality of variables. It adds no syntax or scoping detail beyond the schema, so baseline 3 applies.

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 and resource ('Render a Home Assistant Jinja2 template server-side') and immediately shows what that means with two concrete template examples. The 'cheapest way to read or compute many values at once' framing sets it apart from the state-reading siblings like ha_get_state and ha_list_states.

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

Usage Guidelines4/5

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

Gives a clear when-to-use rule ('cheapest way to read or compute many values at once'), which is the main selection driver versus ha_get_state or ha_list_states. It stops short of an explicit when-not or naming the alternative tools, so it is strong but not complete.

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