Skip to main content
Glama

Assign label to device

labels_assign_label_to_device
Idempotent

Assign a label to a Home Assistant device while keeping its existing labels. Appends the label ID and writes the full list back.

Instructions

Assign a label to a device, keeping its existing labels.

Reads the device's current labels list from the device registry, appends label_id if not already present, and writes the full list back via WS config/device_registry/update.

Use when: tagging one device with a label without disturbing labels already on it. Not for: removing a label — use labels_remove_label_from_device. Returns: dict with device_id, the resulting labels list, the raw WS result, and ok. Errors: on a WS failure, returns {"device_id": ..., "label_id": ..., "ok": false, "error": "<message>"}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
label_idYesLabel registry ID to assign; obtain it from labels_list_labels.
device_idYesDevice registry ID to tag; obtain it from devices_list_devices.

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 / device_id / description
      Added value: +"Device registry ID to tag; obtain it from devices_list_devices."
    • addedInput schema / properties / label_id / description
      Added value: +"Label registry ID to assign; obtain it from labels_list_labels."
  2. First observedv0.3.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations declare readOnlyHint=false, idempotentHint=true, destructiveHint=false, and the description explains the exact mechanism (read current labels, append if absent, write full list back via config/device_registry/update) — which is precisely why it is idempotent and non-destructive. It further discloses the return shape and the error contract on WS failure, adding real context beyond the annotations.

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 operation, then uses labeled blocks (mechanism, Use when, Not for, Returns, Errors) so an agent can scan to the relevant line. Every sentence carries distinct information with no repetition of the title.

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 two-param mutation with a full input schema and an output schema, the description covers purpose, routing, mechanism, success return keys, and failure shape. There is no meaningful gap an agent would need filled before calling it.

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?

Schema description coverage is 100% and both params are documented there, including how to obtain the IDs, so the baseline is 3. The description reinforces semantics by explaining that label_id is appended only if not already present, but adds no format or constraint detail beyond the schema.

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 ('Assign a label to a device') and immediately qualifies the scope with 'keeping its existing labels', which distinguishes it from a generic set/replace operation. It also names the sibling it is not (labels_remove_label_from_device), so an agent can disambiguate without reading schemas.

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: tagging one device with a label without disturbing labels already on it' and 'Not for: removing a label — use labels_remove_label_from_device' give both the positive condition and the exclusion with the alternative named. 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