Skip to main content
Glama

Remove energy source

energy_remove_energy_source
DestructiveIdempotent

Remove a specific energy source from Home Assistant energy preferences by its statistic ID. Useful for undoing an add call or cleaning up a source that no longer exists.

Instructions

Remove an energy source identified by its stat_energy_from.

Reads the current preferences, drops any solar/battery/gas/water source whose stat_energy_from matches, also strips matching flow_from entries from the grid source, and saves the resulting list via WS energy/save_prefs. This replaces the whole energy_sources list with one that has the matching entries removed — anything else in the list is preserved as-is.

Use when: undoing an energy_add_solar_source/energy_add_battery_source/ energy_add_grid_consumption call, or dropping a source that no longer exists. Not for: replacing the whole source list at once — use energy_save_energy_prefs. Returns: {"status": "removed", "removed": <count>, "stat_energy_from": ..., "result": ...} on success, or {"status": "not_found", "stat_energy_from": ...} when nothing matched. Errors: {"error": str(e), "stat_energy_from": ...} when either WS call raises.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stat_energy_fromYesStatistic/entity ID identifying the source to remove, as originally passed to one of the `energy_add_*` tools, e.g. 'sensor.solar_production'.

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 / stat_energy_from / description
      Added value: +"Statistic/entity ID identifying the source to remove, as originally passed to one of the `energy_add_*` tools, e.g. 'sensor.solar_production'."
  2. First observedv0.3.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and idempotentHint=true, but the description adds substantial context beyond them: it discloses the read-modify-write sequence via WS `energy/save_prefs`, explains that it strips matching `flow_from` entries from the grid source as a side effect, and confirms non-matching entries are preserved. This is exactly the extra behavioral context the annotations cannot provide.

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 purpose, then a precise behavioral paragraph, then explicit Use when / Not for / Returns / Errors sections. Every sentence carries information; no padding.

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?

Given a mutation tool with annotations and an output schema, the description covers the remaining gaps: the read-modify-write mechanism, side effects, success/not-found/error return shapes, and the alternative tool. An agent has everything needed to call it correctly.

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 schema already documents the single parameter well (including an example). The description adds value by tying the parameter to its origin (value as originally passed to `energy_add_*`) and describing how it is used to match both the primary source and related `flow_from` entries, which goes slightly beyond the schema description.

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 (Remove) and resource (energy source) and identifies the exact key (`stat_energy_from`) used to target it. It also differentiates itself from the sibling `energy_save_energy_prefs` by noting it is not the whole-list replacement tool.

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?

Explicitly says when to use it (undoing `energy_add_*` calls, dropping stale sources) and when not to (replacing the whole list — use `energy_save_energy_prefs`). This directly satisfies the when/when-not/alternatives bar.

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