Skip to main content
Glama

Assign label to entity

labels_assign_label_to_entity
Idempotent

Tag a Home Assistant entity with a label, preserving all existing labels. Reads current labels, appends the new label ID, and writes the updated list back via WebSocket.

Instructions

Assign a label to an entity, keeping its existing labels.

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

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
label_idYesLabel registry ID to assign; obtain it from labels_list_labels.
entity_idYesEntity ID to tag, e.g. 'light.kitchen'.

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 / entity_id / description
      Added value: +"Entity ID to tag, e.g. 'light.kitchen'."
    • 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.6/5.0
Behavior4/5

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

Annotations already declare idempotentHint, non-destructive, and non-readOnly, but the description adds real mechanism: it reads the current labels list, appends only if absent, and writes the full list back via a named WS endpoint. The error return shape is also disclosed. Minor deduction because the 'Returns' text substantially duplicates the existing output schema.

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 action, then structured into behavior, Use when/Not for, Returns, and Errors. Well-organized, though the Returns section is somewhat redundant given an output schema exists.

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-parameter mutation with annotations and an output schema, everything needed to call it correctly is present: preconditions, additive semantics, error shape, and the sibling alternative for removal.

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 baseline is 3, but the description adds meaning beyond the schema by stating that label_id is appended only if not already present, implying the dedupe/idempotency behavior for that parameter. It does not add format or lookup details beyond what the schema descriptions already provide.

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 (assign) and resource (label to entity), and explicitly distinguishes itself from the sibling labels_remove_label_from_entity. An agent can route this correctly without opening a 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?

Has an explicit 'Use when' clause (tagging one entity without disturbing existing labels) and a 'Not for' clause naming the alternative tool to use for removal. This is the full when/when-not/alternative pattern.

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