Skip to main content
Glama

Add battery source

energy_add_battery_source

Add a home battery to the Energy Dashboard by linking charge and discharge energy sensors as one battery source.

Instructions

Add a battery source to the Energy Dashboard.

Reads the current preferences, appends a new {"type": "battery", ...} entry combining stat_energy_from (discharge) and stat_energy_to (charge) to the energy_sources list, and saves it via WS energy/save_prefs. Calling it twice with the same arguments adds a second, duplicate source.

Use when: registering a home battery's charge and discharge sensors as one Energy Dashboard source. Not for: grid or solar sources — use energy_add_grid_consumption/ energy_add_grid_return/energy_add_solar_source. Returns: {"status": "added", "stat_energy_from": ..., "stat_energy_to": ..., "result": ...}. Errors: {"error": str(e)} when either WS call raises.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stat_energy_toYesStatistic/entity ID of the battery charge (energy in) sensor to add, e.g. 'sensor.battery_charge'.
stat_energy_fromYesStatistic/entity ID of the battery discharge (energy out) sensor to add, e.g. 'sensor.battery_discharge'.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.25.1
    • addedInput schema / properties / stat_energy_from / description
      Added value: +"Statistic/entity ID of the battery discharge (energy out) sensor to add, e.g. 'sensor.battery_discharge'."
    • addedInput schema / properties / stat_energy_to / description
      Added value: +"Statistic/entity ID of the battery charge (energy in) sensor to add, e.g. 'sensor.battery_charge'."
  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 readOnlyHint=false, idempotentHint=false and destructiveHint=false; the description goes beyond them by disclosing the read-modify-write sequence, the underlying WS call used, and the concrete non-idempotent consequence ('calling it twice with the same arguments adds a second, duplicate source'). It also documents the response and error shapes, so the mutation's side effects and failure mode are fully visible.

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 the action and the append-and-save mechanism, then cleanly partitioned into Use when / Not for / Returns / Errors. Every line carries information an agent needs; nothing is repeated from the schema or annotations.

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 2-parameter mutation over an output-schema-bearing tool, the definition covers side effects, idempotency, routing to alternatives, and the error envelope. The presence of an output schema means return values need not be re-explained, yet the description still summarizes the success shape, leaving no obvious gap.

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 adds meaning the schema does not: it explains that the two IDs are combined into a single battery entry and maps them to discharge (stat_energy_from) and charge (stat_energy_to). It stops short of adding format/validation details, so it is a modest rather than exhaustive improvement.

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 ('Add a battery source to the Energy Dashboard') and explicitly distinguishes itself from the sibling grid/solar adders. The mechanism (reads prefs, appends a battery entry combining stat_energy_from/stat_energy_to, saves via energy/save_prefs) is concrete enough that an agent can tell it apart from energy_save_energy_prefs or energy_add_solar_source without opening any 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?

Provides an explicit 'Use when' clause (registering a home battery's charge and discharge sensors as one source) and a 'Not for' clause naming the exact alternatives (energy_add_grid_consumption/energy_add_grid_return/energy_add_solar_source). Both the selection condition and the exclusions 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