Skip to main content
Glama

Set an entity state

ha_set_state

Overwrite a Home Assistant entity's state and attributes to update its internal representation, creating the entity if needed; does not control the physical device.

Instructions

Overwrite an entity's state and attributes. This only changes the representation inside Home Assistant — it does NOT talk to the physical device. To control a device, use ha_call_service instead. Args: entityId (required), state (required), attributes (optional). Creates the entity when it does not exist yet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateYesNew state value
entityIdYesEntity id to set
attributesNoAttributes to store with the state

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare the mutation profile (readOnlyHint=false, destructiveHint=false), but the description adds substantial non-obvious context: the change is internal-only, not a device command, and the entity is created if absent. It omits the non-idempotent behavior flagged by idempotentHint=false, which would have been worth calling out.

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?

The critical warning and the alternative routing are front-loaded in the first two sentences, which is exactly right. The trailing args list is partly redundant with the schema, costing a bit of density but not clarity.

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 3-parameter mutation tool with no output schema, the description covers everything material: what is overwritten, that the effect is representational rather than physical, the sibling to use for real control, and the create-on-missing edge case.

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%, so the schema already documents entityId, state, and attributes. The description's args list (required/optional markers) largely restates the schema's required array rather than adding format, naming conventions, or attribute semantics.

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 ('Overwrite an entity's state and attributes') and immediately draws the boundary against the sibling tool that actually controls devices. An agent can distinguish this from ha_call_service and ha_delete_state 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?

Explicitly says when NOT to use it ('it does NOT talk to the physical device') and names the correct alternative ('use ha_call_service instead'). This is the routing information an agent needs before acting.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.