Skip to main content
Glama
homeassistant-ai

Home Assistant MCP Server

Official

Get Entity State

ha_get_state
Read-onlyIdempotent

Retrieve current state and attributes for one or multiple Home Assistant entities, including lights, switches, and sensors, to check status or monitor device values.

Instructions

Get current status, state, and attributes of one or more entities (lights, switches, sensors, climate, covers, locks, fans, etc.).

Pass a string entity_id for one entity, or a list (max 100, duplicates deduplicated) for several, fetched in parallel. A bulk call returns success=True if at least one state was retrieved; check 'error_count' for failed lookups.

fields= projects the per-entity record keys, NOT the outer bulk response wrapper: in single-entity mode it filters the returned record; in bulk mode it filters each record inside states[entity_id] while outer keys (success, count, states, errors, ...) are always preserved. attribute_keys= further narrows the attributes sub-dict and is only applied when "attributes" is in fields= (or fields=None); otherwise it is a no-op and a warnings list is emitted outside the projected record(s) — at the response wrapper level in bulk mode, at the top-level result (sibling of data/metadata) in single-entity mode — so fields=["state"] still returns a record with only state.

EXAMPLES:

  • Single: ha_get_state("light.kitchen")

  • Multiple: ha_get_state(["light.kitchen", "light.living_room", "sensor.temperature"])

  • Slim bulk: ha_get_state(["light.kitchen", "sensor.temperature"], fields=["state", "attributes"], attribute_keys=["brightness"])

get current state value single entity check status bulk multiple states which lights

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoReturn only the specified top-level entity record keys to reduce response size (e.g. ["state", "attributes"]). None = full entity record. Available keys: entity_id, state, attributes, last_changed, last_reported, last_updated, context.
entity_idYesEntity ID or list of entity IDs to retrieve state for (e.g., 'light.kitchen' or ['light.kitchen', 'sensor.temperature'])
attribute_keysNoReturn only the specified keys from each entity's attributes dict (e.g. ["brightness", "color_temp_kelvin"] for lights). None = full attributes. Unknown keys are silently dropped.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv8.6.0
    • changedInput schema / properties / attribute_keys / description
      Previous value: -"Return only the specified keys from each entity's attributes dict (e.g. [\"brightness\", \"color_temp_kelvin\"] for lights). None = full attributes (default). Unknown keys are silently dropped. Requires \"attributes\" to be present in fields= (or fields=None)."New value: +"Return only the specified keys from each entity's attributes dict (e.g. [\"brightness\", \"color_temp_kelvin\"] for lights). None = full attributes. Unknown keys are silently dropped."
    • changedInput schema / properties / fields / description
      Previous value: -"Return only the specified top-level entity record keys to reduce response size (e.g. [\"state\", \"attributes\"]). None = full entity record (default). Available keys: entity_id, state, attributes, last_changed, last_reported, last_updated, context."New value: +"Return only the specified top-level entity record keys to reduce response size (e.g. [\"state\", \"attributes\"]). None = full entity record. Available keys: entity_id, state, attributes, last_changed, last_reported, last_updated, context."
  2. First observedv7.14.2

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already declare read-only/idempotent/non-destructive, and the description goes well beyond them: bulk partial-success semantics ('success=True if at least one state was retrieved'), error_count reporting, fields projection behavior on the wrapper vs record, and the no-op + warnings behavior when attribute_keys is used without 'attributes' in fields. This is exactly the extra behavioral context annotations cannot carry.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The body is dense but front-loaded with examples and every clause about projection behavior earns its place. However, the trailing fragment ('get current state value single entity check status bulk multiple states which lights"') is noisy keyword residue that adds no meaning and slightly undermines structure.

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?

With an output schema present, the description needn't restate return shapes, and it instead supplies the non-obvious bulk/projection semantics an agent needs. Annotations cover safety, schema covers parameters, description covers behavior — coverage is complete for a 3-param read tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so 3 is the baseline, but the description materially adds meaning the schema lacks: that fields projects per-entity record keys rather than the outer bulk wrapper, that attribute_keys only applies when 'attributes' is in fields, and that duplicates are deduplicated with a 100-item cap. This is substantive semantics beyond the schema text.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('Get'), resource ('state, attributes'), and entity scope (single vs list of up to 100). It implicitly distinguishes itself from ha_get_history by emphasizing 'current' state and from write tools like ha_call_service, but it never names a sibling explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Clearly explains the two usage modes (string for one entity, list for bulk) and gives worked examples for each. It does not state when to prefer this over alternatives such as ha_get_history or ha_search, nor any exclusion conditions, so it stops short of a 5.

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