Skip to main content
Glama

Update theme file

themes_update_theme
Destructive

Modify an existing Lovelace theme in Home Assistant by merging or replacing its variables; reload themes after saving.

Instructions

Update an existing Lovelace theme file.

With merge=True (default), shallow-merges the given variables into the existing top-level keys — a passed modes key replaces the whole modes block rather than merging inside it; with merge=False, replaces the entire variable set. Fails if the theme file doesn't exist yet.

Use when: changing some or all variables on a theme that already exists. Not for: a theme that doesn't exist yet — use themes_create_theme. Returns: dict with success, path, merged, and reloaded (present when reload=True). Errors: {"success": false, "error": "Theme '<name>' not found at <path>"} when the file doesn't exist; {"success": false, "error": "invalid_theme_name", "detail": ...} when name contains '/' or a backslash, starts with '.', or is blank.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesTheme name to update; obtain it from themes_list_themes or themes_list_theme_files.
mergeNoIf true, shallow-merges variables into the existing top-level keys; if false, replaces the whole variable set; defaults to true.
reloadNoIf true, calls frontend.reload_themes after writing the file; defaults to true.
variablesYesVariable map to apply; merged into or replacing the existing set depending on `merge`.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.25.1
    • addedInput schema / properties / merge / description
      Added value: +"If true, shallow-merges variables into the existing top-level keys; if false, replaces the whole variable set; defaults to true."
    • addedInput schema / properties / name / description
      Added value: +"Theme name to update; obtain it from themes_list_themes or themes_list_theme_files."
    • addedInput schema / properties / reload / description
      Added value: +"If true, calls frontend.reload_themes after writing the file; defaults to true."
    • addedInput schema / properties / variables / description
      Added value: +"Variable map to apply; merged into or replacing the existing set depending on `merge`."
  2. Addedv0.4.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and idempotentHint=false, and the description adds the exact mechanics of that destructiveness: 'merge=True' shallow-merges and a passed 'modes' key replaces the whole block, while 'merge=False' replaces the entire variable set. It also discloses the failure mode (theme must exist), the reload side effect, and concrete error payloads.

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 core action, then uses labeled 'Use when / Not for / Returns / Errors' blocks so an agent can skim to the section it needs. Every sentence carries distinct information; no filler.

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?

For a destructive mutation tool with four parameters, nested objects, and an output schema, the description covers semantics, preconditions, side effects, return shape, and error cases. Nothing needed to invoke it correctly is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description goes beyond the schema by spelling out the shallow-merge caveat with the 'modes' example and the full-replace behavior of merge=False. The only gap is that 'reload' and 'name' are left entirely to the schema text.

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+resource ('Update an existing Lovelace theme file') and immediately distinguishes itself from its sibling by naming themes_create_theme as the tool for non-existent themes. An agent can route between the two 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?

Contains explicit 'Use when' and 'Not for' blocks, plus a named alternative (themes_create_theme) with the precise condition that selects it. Nothing is left to inference.

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