Skip to main content
Glama

Remove device from config entry

devices_remove_device
DestructiveIdempotent

Removes a stale device from Home Assistant only after confirming it belongs to the given config entry, so outdated devices can be cleaned up without affecting other integrations.

Instructions

Remove a device from Home Assistant after checking it belongs to the given config entry.

Reads the device registry and refuses unless the device belongs to config_entry_id, then sends WS config/device_registry/remove (HA 2026.x); on an HA without that command it sends the older config/device_registry/remove_config_entry. The integration must support device removal (HA asks it first), otherwise HA refuses.

Use when: removing a stale device an integration no longer provides. Not for: renaming, moving or disabling it — use devices_update_device. Returns: {"removed": true, "device_id", "config_entry_id", "command"}. Errors: device_not_found, config_entry_not_in_device (no removal sent), ws_error with Home Assistant's code/message (e.g. the integration rejected the removal). Limits: config_entry_id is required as a safety check even though HA 2026.x removes the device as a whole.

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": {
      "device_id": "<device_id>",
      "config_entry_id": "<config_entry_id>"
    },
    "name": "devices_remove_device"
  }
}

Input Schema

NameRequiredDescriptionDefault
device_idYesDevice registry ID to remove; obtain it from devices_list_devices.
config_entry_idYesConfig entry ID the device is attached to; the device is detached only from this entry.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.25.1
    • addedInput schema / properties / config_entry_id / description
      Added value: +"Config entry ID the device is attached to; the device is detached only from this entry."
    • addedInput schema / properties / device_id / description
      Added value: +"Device registry ID to remove; obtain it from devices_list_devices."
  2. First observedv0.3.0

TDQS

A4.9/5.0
Behavior5/5

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

The annotations already declare destructive=true, idempotent=true, readOnly=false, and openWorld=false, so the safety profile is known. The description adds important behavior beyond those annotations: it reads the device registry, refuses unless the device belongs to config_entry_id, sends a version-dependent WS command, requires integration support for removal, and lists concrete error cases. This is a high level of transparency for a destructive mutation tool.

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

Conciseness5/5

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

The description is front-loaded with the core operation and then clearly separated into Use when, Not for, Returns, Errors, and Limits sections. Every sentence carries useful information for a destructive tool with version-dependent behavior, and there is no filler or repetition.

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?

Given the tool is destructive and has version-dependent WS behavior, the description is complete enough to call it correctly: it covers validation, refusal conditions, alternative command paths, integration support requirements, return shape, and error codes. The output schema exists, but the description's return summary is still helpful and does not omit anything essential.

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%, so the baseline is 3 because the schema already documents both parameters. The description adds meaningful context by explaining that config_entry_id is required as a safety check even though HA 2026.x removes the device as a whole, and that the device is detached only from the specified entry. It stops short of a 5 because the schema already conveys some of the detachment 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?

The description states a specific verb and resource: remove a device from Home Assistant after validating it belongs to the given config entry. It also distinguishes this operation from a sibling by naming devices_update_device for renaming, moving, or disabling. An agent can identify the operation and its scope 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?

The description gives explicit when-to-use guidance: removing a stale device an integration no longer provides. It also gives explicit when-not-to-use guidance and routes the agent to devices_update_device for renaming, moving, or disabling. No ambiguity remains about selecting this tool versus the named alternative.

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