Skip to main content
Glama
Home Assistant MCP Server

Home Assistant MCP Server

by rilhia

Render a Jinja2 template

render_template
Read-onlyIdempotent

Evaluate Home Assistant Jinja2 templates on the server to compute across many entities or test automation logic before deployment; template evaluation is read-only and cannot change state.

Instructions

Evaluate a Home Assistant Jinja2 template on the server through POST /api/template. Useful for computing across many entities at once, for example {{ states.light | selectattr('state','eq','on') | map(attribute='entity_id') | list }}, or for testing a template before putting it in an automation. Templates are read-only and cannot change state.

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": {
      "template": "<template>"
    },
    "name": "render_template"
  }
}

Input Schema

NameRequiredDescriptionDefault
templateYesThe Jinja2 template string.
variablesNoOptional variables made available to the template.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A3.9/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, so safety is covered; the description reinforces this ('Templates are read-only and cannot change state') and adds that evaluation happens server-side. It says nothing about behavior on invalid templates, error responses, or output shape, which is the remaining gap.

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 use cases, then a realistic example, then the read-only caveat. The example earns its length by showing the intended cross-entity pattern rather than restating the schema.

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

Completeness3/5

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

There is no output schema, so the description carries the burden of explaining return values, and it never says that the rendered string is returned. For a two-parameter evaluation tool the rest of the picture is adequate, but the missing return description is a real gap.

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% for both parameters, so the baseline applies. The description never mentions the optional 'variables' parameter, which is the one non-obvious input (a nested object of template context), leaving that meaning entirely to the schema.

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 ('Evaluate a Home Assistant Jinja2 template') plus the underlying endpoint (POST /api/template), which tells an agent exactly what happens. No sibling tool renders templates, so the differentiation is implicit but unambiguous.

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 two concrete when-to-use conditions: computing across many entities at once, and testing a template before putting it in an automation. It does not name an explicit alternative or when-not case (e.g. 'use search_entities for simple filtering'), so it stops short of a 5.

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