Skip to main content
Glama
homeassistant-ai

Home Assistant MCP Server

Official

Remove Entity

ha_remove_entity
DestructiveIdempotent

Permanently delete orphaned or stale entities from the Home Assistant registry, in single or bulk mode, to clear entries no longer used by the UI or automations.

Instructions

Remove one or more entities from the Home Assistant entity registry.

Permanently removes the entity registration; the entity will no longer appear in the UI or be available to automations. Use only for orphaned or stale entity entries: if the underlying device or integration is still active, the entity may be re-added automatically on the next HA restart or reload. This cannot be undone without restoring from backup. For most use cases, consider disabling instead: ha_set_entity(entity_id="sensor.old", enabled=False).

BULK MODE: Pass a list of entity IDs to remove up to 100 at once — handy for clearing the restored=true orphans an integration leaves behind after its filters change. Removals run sequentially and return: {removed: [...], skipped: [...], errors: [{entity_id, code, message}]} where skipped = ids already absent (not-found is idempotent, not an error). Bulk mode is NOT auto-backed-up (the snapshot is single-entity); single-id removal still is.

EXAMPLES:

  • Remove orphaned sensor: ha_remove_entity("sensor.old_temperature")

  • Bulk cleanup: ha_remove_entity(["sensor.orphan_1", "sensor.orphan_2"])

Use ha_search / ha_get_entity to verify an entity before removing it.

If a Claude Desktop user gets a 4-minute timeout with no result on this call, read the target back before repeating it, and tell them to wait a few seconds before clicking the manual-approve button, as clicking it too quickly is known to cause hangs in Claude Desktop. This workaround is specific to Claude Desktop.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYesEntity ID, or a list of entity IDs, to remove from the entity registry (e.g., 'sensor.old_temperature').

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv8.6.0
    • changedInput schema / properties / entity_id / description
      Previous value: -"Entity ID, or a list of entity IDs, to remove from the entity registry (e.g., 'sensor.old_temperature'). Permanently removes the registration(s)."New value: +"Entity ID, or a list of entity IDs, to remove from the entity registry (e.g., 'sensor.old_temperature')."
  2. First observedv7.14.2

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the annotations (destructiveHint/idempotentHint), disclosing that removal is permanent and unrestorable without a backup, that re-addition can occur automatically, that bulk mode is limited to 100 IDs and is NOT auto-backed-up while single-id removal is, that removals run sequentially, and that not-found ids are returned as skipped rather than errors. The backup asymmetry between single and bulk mode is exactly the kind of trait annotations cannot express.

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 purpose and the critical irreversibility warning, then cleanly sectioned into BULK MODE and EXAMPLES. It is on the long side and the closing Claude Desktop timeout workaround paragraph is verbose and tangential to invocation, though it is operationally useful.

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?

Despite an output schema existing, the description still documents the return shape (removed/skipped/errors) because the bulk response semantics are non-obvious. Combined with the alternative path, verification advice, and idempotency semantics, an agent has everything needed to call this safely and interpret the result.

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% with a single well-documented parameter, so the baseline is 3; the description adds real meaning on top, specifying that the list form triggers bulk mode, caps at 100, runs sequentially, and reports skipped/errors. It does not, however, add any per-value formatting or validation rules 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 (remove) and resource (entities in the Home Assistant entity registry), and explicitly scopes it to the registry rather than the device/integration, which separates it from siblings like ha_remove_device and ha_remove_helpers_integrations. An agent can identify the operation and its target without opening the 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?

Gives explicit when-to-use (orphaned or stale entity entries), when-not-to-use (if the underlying device/integration is still active the entity will be re-added on restart), and names a concrete alternative with call syntax: ha_set_entity(entity_id="sensor.old", enabled=False). It also tells the agent to verify first via ha_search / ha_get_entity.

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