Skip to main content
Glama

Cross-check automation YAML against live HA

automations_validate_automation_references
Read-onlyIdempotent

Verifies that entity IDs and services referenced in Home Assistant automation YAML exist in the live registry, ensuring valid references before saving.

Instructions

Cross-check entity IDs and services used in automation YAML against the live registry.

Unlike automations_validate_best_practices (static), this calls ha.get_states() and ha.list_services() to verify that every literal entity_id value and every literal service:/action: string in yaml_content exists. It only looks at literal values — it does NOT resolve device_id, area_id, label_id, or any templated reference, not just the ones containing '{{ ... }}' (which are explicitly skipped and counted in template_refs_skipped).

Use when: checking that an automation's references are real before saving it with automations_set_automation_config. Not for: YAML syntax or authoring-rule checks — use automations_validate_best_practices. Returns: dict {valid_yaml, automations_checked, entities_checked, services_checked, missing_entities[], missing_services[], template_refs_skipped, entities_check, services_check, errors[], summary}. entities_check/services_check are 'ok' or 'unavailable'. Errors: returns {"valid_yaml": False, "error": "YAML parse error: ..."} for invalid YAML. When ha.get_states() or ha.list_services() raises, the matching entities_check/services_check is 'unavailable' and errors names which fetch failed; the corresponding missing_* list stays empty rather than reporting a false "nothing missing" or a false "everything is missing". Limits: fetches the full live state list and full service list on every call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yaml_contentYesYAML text of a single automation dict or a list of automation dicts to check. Parsed with plain `yaml.safe_load`, so HA-only tags like '!input'/'!secret' are not resolved.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.25.1
    • addedInput schema / properties / yaml_content / description
      Added value: +"YAML text of a single automation dict or a list of automation dicts to check. Parsed with plain `yaml.safe_load`, so HA-only tags like '!input'/'!secret' are not resolved."
  2. Addedv0.18.1

TDQS

A4.6/5.0
Behavior5/5

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

Annotations cover the safety profile (readOnly, idempotent, non-destructive), and the description goes well beyond them: it names the exact upstream calls made (`ha.get_states()`, `ha.list_services()`), enumerates what is deliberately not resolved (device_id, area_id, label_id, templates), and specifies failure semantics — 'unavailable' checks with errors naming the failed fetch, and empty rather than misleadingly-empty missing_* lists. The per-call full-state/full-service fetch cost is also disclosed.

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?

Front-loaded with the core purpose, then cleanly blocked into Use when / Not for / Returns / Errors / Limits. Nearly every sentence carries information, though the parenthetical about templates ('not just the ones containing '{{ ... }}'') is awkwardly nested mid-sentence and could be tightened.

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?

Despite an output schema existing, the description still enumerates the return keys and explains the 'ok'/'unavailable' check semantics and error shape, which the schema alone would not convey. Combined with limits and non-resolution rules, an agent has everything needed to call and interpret this tool correctly.

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?

Only one parameter and schema description coverage is 100%, so the schema already documents `yaml_content` fully (including the plain `yaml.safe_load` parsing and unresolved HA-only tags). The description reinforces the literal-only inspection semantics, which is useful framing, but adds no new parameter-level syntax or format detail. 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 ('cross-check entity IDs and services used in automation YAML against the live registry') and immediately distinguishes itself from the similarly-named sibling `automations_validate_best_practices` by labeling that one static. An agent can select this tool 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?

Explicit 'Use when' clause ties it to a concrete workflow ('before saving it with automations_set_automation_config') and an explicit 'Not for' clause routes YAML syntax/authoring checks to the named alternative. Both the positive and negative conditions are stated rather than inferred.

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