Skip to main content
Glama

Render a Jinja2 template via subscription

ws_render_template
Read-onlyIdempotent

Render a Jinja2 template using Home Assistant's WebSocket render_template subscription, waiting for the streamed event result. Use when WebSocket transport is specifically required.

Instructions

Render a Jinja2 template through HA's WebSocket render_template subscription.

Sends render_template; HA acknowledges the subscription with a null result, then streams the rendered value in a follow-up event. This waits up to timeout seconds for that event and returns its result.

Use when: the WebSocket transport itself is specifically required. Not for: a one-shot render — use services_render_template, a plain HTTP call with no subscription semantics. Returns: the rendered template value from the event's result field. Errors: raises RuntimeError when the template itself errors (e.g. an undefined variable), when the WebSocket handshake does not complete within timeout, or when no event arrives within timeout. Limits: blocks for up to timeout seconds (default 10), including the initial handshake.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeoutNoMaximum seconds to wait for the rendered value before raising an error; must be between 1 and 300.
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. Changed2 schema fields changedv0.25.1
    • addedInput schema / properties / template / description
      Added value: +"Jinja2 template string to render, e.g. '{{ states(\"sensor.temp\") }}'."
    • addedInput schema / properties / timeout
      Added value: +{
      +  "default": 10,
      +  "description": "Maximum seconds to wait for the rendered value before raising an error; must be between 1 and 300.",
      +  "maximum": 300,
      +  "minimum": 1,
      +  "type": "number"
      +}
  2. First observedv0.3.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, but the description adds substantial protocol context: the subscription ack, streaming of the value in a follow-up event, blocking up to timeout seconds, and the three RuntimeError conditions. This is well beyond what the annotations convey.

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 with purpose, then clearly labelled Use/Not for/Returns/Errors/Limits sections. Every sentence carries distinct, non-redundant information despite the length.

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, yet the description still names the return field and enumerates failure modes and blocking limits. Nothing an agent needs to call this correctly — transport choice, timeout behavior, error conditions — is missing.

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%, so the schema already documents both template and timeout (including range 1-300, default 10). The description reinforces the timeout blocking behavior but adds no syntax beyond the schema, so the 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 (render), resource (Jinja2 template), and mechanism (HA WebSocket render_template subscription). It explicitly distinguishes itself from the one-shot sibling services_render_template, so an agent can route without opening either schema.

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?

Provides an explicit 'Use when: the WebSocket transport itself is specifically required' and 'Not for: a one-shot render — use services_render_template'. Both the selection condition and the named alternative are present.

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