Skip to main content
Glama
Home Assistant MCP Server

Home Assistant MCP Server

Official

Get Entity State

ha_get_state
Read-onlyIdempotent

Retrieve the current state and attributes of one or more Home Assistant entities, including bulk lookups, to check device status or inspect entity details.

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 at the top level of the result (sibling of data/metadata), outside the projected record(s), 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

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "entity_id": "<entity_id>"
    },
    "name": "ha_get_state"
  }
}

Input 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

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.3/5.0
Behavior5/5

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

Annotations only declare read-only/idempotent/non-destructive; the description adds substantive behavior the annotations cannot: partial-success semantics in bulk mode ('success=True if at least one state was retrieved'), the need to check 'error_count', the 100-item cap with dedupe, and parallel fetching. It also discloses the warning-emission side effect when attribute_keys is used outside an attributes projection.

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?

Core behavior is front-loaded, the projection paragraph is dense but earns its length, and the EXAMPLES block is genuinely useful. The trailing keyword-salad line ('get current state value single entity check status bulk multiple states which lights') is unstructured noise that adds no information and slightly dilutes an otherwise disciplined layout.

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 three-parameter read tool with a full output schema, this covers everything an agent needs: input modes, limits, projection semantics, partial-failure signaling, and where warnings surface relative to the projected record. Nothing required to call it correctly is missing.

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 the baseline would be 3, but the description goes well beyond it: it explains that fields projects per-entity record keys rather than the outer bulk wrapper, that outer keys are always preserved, and that attribute_keys is a no-op unless 'attributes' is in fields. That interaction rule is invisible in the schema and is exactly the kind of semantics an agent would otherwise get wrong.

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?

Opens with a specific verb and resource ('Get current status, state, and attributes of one or more entities') and enumerates the entity domains covered. It never names a sibling such as ha_get_entity, ha_get_history, or ha_get_overview, so the agent gets no explicit differentiation from those adjacent read tools.

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

Usage Guidelines3/5

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

The description tells you how to invoke it in both modes (single string vs. list, max 100, deduplicated, fetched in parallel) and gives worked examples. It stops short of when-to-use guidance: nothing says to prefer ha_get_history for past states or ha_get_entity for registry metadata, so selection between siblings 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