Skip to main content
Glama
Home Assistant MCP Server

Home Assistant MCP Server

Official

Remove Entity

ha_remove_entity
DestructiveIdempotent

Removes one or more entities from the Home Assistant entity registry to clean up orphaned or stale entries, including bulk deletion of up to 100 IDs at once.

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, integration or stored helper is still there, the entity may be re-added on the next HA restart or reload; for a stored helper's entity a single-id removal names the tool that removes the helper. Added again, it gets back its registry settings while its config entry exists, and for 30 days after that entry, or an entity without one, was removed. 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). A lost connection stops the run; not_attempted lists the ids never sent (the failing one too if it never left), safe to retry. Only single-id removal is auto-backed-up.

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.

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_remove_entity"
  }
}

Input Schema

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

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

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

Annotations already declare destructive/idempotent/non-readonly, but the description goes well beyond them: permanence, re-add behavior on restart/reload, the 30-day registry-settings restore window, a 100-id bulk cap, sequential execution, and partial-failure semantics (skipped = not-found is idempotent, not_attempted is safe to retry). It also discloses that only single-id removal is auto-backed-up, which is critical pre-call information an agent cannot get from annotations.

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?

Front-loaded and well-sectioned with BULK MODE and EXAMPLES headers, but the restore-window sentence ("Added again, it gets back its registry settings while its config entry exists, and for 30 days after that entry, or an entity without one, was removed") is syntactically tangled, and the Claude Desktop paragraph is long relative to its narrow applicability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive single-parameter tool with annotations and an output schema, almost everything an agent needs is present: safety profile, alternatives, bulk limits, failure handling, and recovery semantics. The one gap is that the re-add / 30-day restore behavior is stated in a way that is hard to parse, which matters for a destructive operation.

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% and the schema already documents the string-or-array union, so the baseline is 3. The description adds real meaning beyond it: the array form caps at 100 ids, executes sequentially, and changes the return contract, which affects how an agent should batch calls.

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?

"Remove one or more entities from the Home Assistant entity registry" states a specific verb, resource, and cardinality. It is clearly separable from siblings like ha_remove_device (device registry), ha_remove_helpers_integrations (helper/integration level), and ha_set_entity (which it explicitly points to for disabling).

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?

Explicit when-to-use ("Use only for orphaned or stale entity entries"), explicit alternative ("consider disabling instead: ha_set_entity(entity_id=..., enabled=False)"), a pointer to the helper-removal tool for stored helpers, and a verification step via ha_search / ha_get_entity. The only weakness is the garbled sentence about stored helpers, but the routing intent is still recoverable.

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