Skip to main content
Glama
TheWhykiki

hass-mcp

by TheWhykiki

ha_render_template

Render a Jinja2 template to generate dynamic content from Home Assistant data.

Instructions

Render a Jinja2 template and return the result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateYes

Implementation Reference

  • The renderTemplate method in HomeAssistantClient that sends a POST request to HA's /api/template endpoint with the template string and returns the rendered result as text.
    async renderTemplate(params: { template: string }) {
      const baseUrl = normalizeBaseUrl(this.config.url)
      const url = joinUrl(baseUrl, '/api/template')
    
      const res = await fetch(url, {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${this.config.token}`,
          'Content-Type': 'application/json',
        },
        body: JSON.stringify(params),
      })
    
      if (!res.ok)
        throw new Error(`Home Assistant REST error ${res.status} ${res.statusText}`)
    
      return await res.text()
    }
  • The MCP tool registration for 'ha_render_template' with the handler that calls ha.renderTemplate(input) and returns the result as text content.
    server.tool(
      'ha_render_template',
      'Render a Jinja2 template and return the result.',
      RenderTemplateInput.shape,
      async (input) => {
        const res = await ha.renderTemplate(input)
        return {
          content: [{ type: 'text', text: res }],
        }
      },
    )
  • Zod schema defining the input for render_template: a required 'template' string field.
    export const RenderTemplateInput = z.object({
      template: z.string().min(1),
    })
Behavior2/5

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

No annotations exist, and the description fails to disclose behavioral traits such as side effects, idempotency, authentication requirements, or error behavior. The burden falls entirely on the description, which only states the action.

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

Conciseness4/5

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

The description is a single sentence with no superfluous information. It is efficient, though its brevity sacrifices behavioral and usage context.

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

Completeness2/5

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

Without an output schema, the description should explain what the result looks like (e.g., rendered string). It also omits any context about template variables, error handling, or limits, making it incomplete for a rendering tool.

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

Parameters2/5

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

The input schema has one parameter 'template' with no description (0% coverage). The description only reiterates that it is a template, adding no detail about format, variables, or escaping, leaving the agent underinformed.

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?

The description clearly states the verb 'Render' and the resource 'Jinja2 template', which is specific and distinguishes it from all sibling tools that deal with areas, lights, states, etc.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives, nor are there any when-not or exclusion conditions. The tool is unique among siblings, but explicit context is missing.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TheWhykiki/hass-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server