Skip to main content
Glama
homeassistant-ai

Home Assistant MCP Server

Official

Set Integration

ha_set_integration
Destructive

Add Home Assistant integrations or manage config entries: enable, disable, update options, reconfigure connection settings, or set log levels.

Instructions

Manage an integration (config entry): enable/disable, add, update options, or reconfigure.

Modes (pick one):

  • Enable/disable: entry_id + enabled.

  • Add integration: domain (+ config) — drives the domain's config flow, including menus and multi-step forms.

  • Update options: entry_id + config — drives the entry's options flow (what the "Configure" button does in the HA UI).

  • Reconfigure: entry_id + reconfigure=True + config — connection settings such as host, port, credentials. Repeat with the token the preflight returns as confirm_token to apply.

  • Log level: log_level + domain (or entry_id) — sets how much the integration logs; read it back with ha_get_integration's log_level.

WHEN NOT TO USE:

  • Helpers (template, group, utility_meter, ...): use ha_config_set_helper. otp is the user's to set up in the HA UI: its secret is a credential enrolled in an authenticator app; do not create it.

  • Config subentries: use ha_config_set_helper(helper_type='config_subentry').

  • Removing an entry: use ha_remove_helpers_integrations.

Use ha_get_integration() to find entry IDs, and ha_get_integration(entry_id=..., include_schema=True) to inspect the options fields before an update. Its supports_reconfigure field tells you whether an entry qualifies for reconfigure=True.

Caveats: adding an integration runs its config flow exactly as the HA UI would (may pair devices, scan the network, create entities). Flows requiring a browser step (OAuth) or an asynchronous provider step error out at that step instead of completing. Reconfigure edits the settings a live integration connects with: a wrong host or credential takes it offline, and there is no automatic rollback — the returned rollback metadata describes repeating the official flow by hand with the previous values, which this tool cannot read back. The preflight does not validate config keys against the integration's form; wrong field names surface on the confirm call.

EXAMPLES:

  • Add: ha_set_integration(domain="workday", config={"name": "Workday"})

  • Update options: ha_set_integration(entry_id="abc123", config={"scan_interval": 30})

  • Reconfigure preflight: ha_set_integration(entry_id="abc123", reconfigure=True, config={"host": "10.0.0.5"}), then repeat adding confirm_token="sha256:..."

  • Debug logging: ha_set_integration(domain="zha", log_level="DEBUG"), then log_level="DEFAULT" to stop

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.

integration config entry enable disable add options reconfigure log level debug logging

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
configNoFlow form data. Updating an existing entry — options or reconfigure — is a patch: a field you omit keeps its current value, and a field set to null is cleared where the integration's schema allows that field to be empty. Multi-step flows consume keys per step. A field two steps declare gets your one value both times; pass step_values={'<step_id>': {'<field>': <value>}} to give a step its own value, or to leave the field out of that step; a LIST of those objects supplies one per encounter when the flow presents a step more than once. Menu steps take 'next_step_id' — a string, or a list of successive selections for flows that present more than one menu (e.g. a menu revisited after each branch, ending in a finish option). The step's data_schema is returned on validation errors so field names can be corrected.
domainNoIntegration domain to add (e.g. 'workday', 'local_calendar').
enabledNoTrue to enable, False to disable the entry. Mutually exclusive with 'domain' and 'config'.
entry_idNoConfig entry ID of an existing integration.
log_levelNoSet the integration's log level, like the integration page's Enable/Disable debug logging: pass the integration with 'domain' (no config flow runs) or 'entry_id', and nothing else. Lasts through the next Home Assistant restart. DEFAULT clears the override: the integration then logs at the inherited default level, and a level set for it in configuration.yaml returns only after a restart.
reconfigureNoUse the existing config entry's official reconfigure flow (its connection settings) instead of its options flow. Without confirm_token this is a read-only preflight that returns one.
expected_macNoRequires reconfigure=True. MAC or IEEE the entry's device must still report.
confirm_tokenNoRequires reconfigure=True. Any token still matching the entry's current state and the same requested config is accepted, so a token stays valid while nothing moves.
expected_device_idNoRequires reconfigure=True. Device registry ID the entry must still own, before and after the change.
expected_unique_idNoRequires reconfigure=True, AND the ha_mcp_tools custom component: Home Assistant does not expose a config entry's unique_id over its API. Without the component this is rejected — anchor on expected_device_id, expected_mac or expected_entity_ids instead.
expected_entity_idsNoRequires reconfigure=True. Exact entity IDs that must remain associated with the entry.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv8.6.0
    • changedInput schema / properties / config / description
      Previous value: -"Flow form data. With 'domain': input for the new integration's config flow. With 'entry_id' alone: input for the entry's options flow (updates its options). Updating an existing entry — options or reconfigure — is a patch: a field you omit keeps its current value, and a field set to null is cleared where the integration's schema allows that field to be empty. Multi-step flows consume keys per step. A field two steps declare gets your one value both times; pass step_values={'<step_id>': {'<field>': <value>}} to give a step its own value, or to leave the field out of that step; a LIST of those objects supplies one per encounter when the flow presents a step more than once. Menu steps take 'next_step_id' — a string, or a list of successive selections for flows that present more than one menu (e.g. a menu revisited after each branch, ending in a finish option). The step's data_schema is returned on validation errors so field names can be corrected."New value: +"Flow form data. Updating an existing entry — options or reconfigure — is a patch: a field you omit keeps its current value, and a field set to null is cleared where the integration's schema allows that field to be empty. Multi-step flows consume keys per step. A field two steps declare gets your one value both times; pass step_values={'<step_id>': {'<field>': <value>}} to give a step its own value, or to leave the field out of that step; a LIST of those objects supplies one per encounter when the flow presents a step more than once. Menu steps take 'next_step_id' — a string, or a list of successive selections for flows that present more than one menu (e.g. a menu revisited after each branch, ending in a finish option). The step's data_schema is returned on validation errors so field names can be corrected."
    • changedInput schema / properties / confirm_token / description
      Previous value: -"Requires reconfigure=True. A token from a reconfigure preflight; applies the change. Any token still matching the entry's current state and the same requested config is accepted, so a token stays valid while nothing moves."New value: +"Requires reconfigure=True. Any token still matching the entry's current state and the same requested config is accepted, so a token stays valid while nothing moves."
    • changedInput schema / properties / domain / description
      Previous value: -"Integration domain to add (e.g. 'workday', 'local_calendar') — starts and drives that domain's config flow. Pass the flow's form fields in 'config'."New value: +"Integration domain to add (e.g. 'workday', 'local_calendar')."
    • changedInput schema / properties / enabled / description
      Previous value: -"True to enable, False to disable the entry. Requires entry_id; mutually exclusive with 'domain' and 'config'."New value: +"True to enable, False to disable the entry. Mutually exclusive with 'domain' and 'config'."
    • changedInput schema / properties / entry_id / description
      Previous value: -"Config entry ID of an existing integration (enable/disable and options-update modes). Omit when adding via 'domain'."New value: +"Config entry ID of an existing integration."
    • addedInput schema / properties / log_level
      Added value: +{
      +  "anyOf": [
      +    {
      +      "enum": [
      +        "DEBUG",
      +        "INFO",
      +        "WARNING",
      +        "ERROR",
      +        "CRITICAL",
      +        "DEFAULT"
      +      ],
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Set the integration's log level, like the integration page's Enable/Disable debug logging: pass the integration with 'domain' (no config flow runs) or 'entry_id', and nothing else. Lasts through the next Home Assistant restart. DEFAULT clears the override: the integration then logs at the inherited default level, and a level set for it in configuration.yaml returns only after a restart."
      +}
  2. Changed1 schema field changedv8.4.1
    • changedInput schema / properties / config / description
      Previous value: -"Flow form data. With 'domain': input for the new integration's config flow. With 'entry_id' alone: input for the entry's options flow (updates its options). Multi-step flows consume keys per step; menu steps take 'next_step_id' — a string, or a list of successive selections for flows that present more than one menu (e.g. a menu revisited after each branch, ending in a finish option). The step's data_schema is returned on validation errors so field names can be corrected."New value: +"Flow form data. With 'domain': input for the new integration's config flow. With 'entry_id' alone: input for the entry's options flow (updates its options). Updating an existing entry — options or reconfigure — is a patch: a field you omit keeps its current value, and a field set to null is cleared where the integration's schema allows that field to be empty. Multi-step flows consume keys per step. A field two steps declare gets your one value both times; pass step_values={'<step_id>': {'<field>': <value>}} to give a step its own value, or to leave the field out of that step; a LIST of those objects supplies one per encounter when the flow presents a step more than once. Menu steps take 'next_step_id' — a string, or a list of successive selections for flows that present more than one menu (e.g. a menu revisited after each branch, ending in a finish option). The step's data_schema is returned on validation errors so field names can be corrected."
  3. Changed6 schema fields changedv8.3.0
    • addedInput schema / properties / confirm_token
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Requires reconfigure=True. A token from a reconfigure preflight; applies the change. Any token still matching the entry's current state and the same requested config is accepted, so a token stays valid while nothing moves."
      +}
    • addedInput schema / properties / expected_device_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Requires reconfigure=True. Device registry ID the entry must still own, before and after the change."
      +}
    • addedInput schema / properties / expected_entity_ids
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Requires reconfigure=True. Exact entity IDs that must remain associated with the entry."
      +}
    • addedInput schema / properties / expected_mac
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Requires reconfigure=True. MAC or IEEE the entry's device must still report."
      +}
    • addedInput schema / properties / expected_unique_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Requires reconfigure=True, AND the ha_mcp_tools custom component: Home Assistant does not expose a config entry's unique_id over its API. Without the component this is rejected — anchor on expected_device_id, expected_mac or expected_entity_ids instead."
      +}
    • addedInput schema / properties / reconfigure
      Added value: +{
      +  "default": false,
      +  "description": "Use the existing config entry's official reconfigure flow (its connection settings) instead of its options flow. Without confirm_token this is a read-only preflight that returns one.",
      +  "type": "boolean"
      +}
  4. Changed1 schema field changedv8.2.0
    • changedInput schema / properties / config / description
      Previous value: -"Flow form data. With 'domain': input for the new integration's config flow. With 'entry_id' alone: input for the entry's options flow (updates its options). Multi-step flows consume keys per step; menu steps take 'next_step_id'. The step's data_schema is returned on validation errors so field names can be corrected."New value: +"Flow form data. With 'domain': input for the new integration's config flow. With 'entry_id' alone: input for the entry's options flow (updates its options). Multi-step flows consume keys per step; menu steps take 'next_step_id' — a string, or a list of successive selections for flows that present more than one menu (e.g. a menu revisited after each branch, ending in a finish option). The step's data_schema is returned on validation errors so field names can be corrected."
  5. First observedv7.14.2

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and idempotentHint=false; the description goes well beyond them by disclosing that adding runs the real config flow (pairing, network scans), that browser/OAuth or async provider steps error out, that a bad reconfigure host/credential takes the integration offline with no automatic rollback, and that log-level changes persist only until restart. These are exactly the side-effect details 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 the purpose and a clear Modes/Caveats/Examples structure, so the length is largely earned. It loses a point for the misplaced Claude Desktop timeout workaround paragraph and a trailing keyword dump ('integration config entry enable disable...') that add bulk without helping tool selection.

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 an 11-parameter, multi-mode, destructive mutation tool, the description covers every mode's prerequisites, mutation risks, the preflight/confirm cycle, prerequisites for the expected_* guard params, and where to verify state. An output schema exists, so return-value detail is correctly omitted.

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, but the description adds real meaning by mapping parameter combinations to modes (entry_id+enabled, domain+config, reconfigure+confirm_token) and showing worked examples. It does not restate the finer schema text about patch semantics or step_values, so it complements rather than duplicates.

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 and resource ('Manage an integration (config entry)') and enumerates the five modes it covers, so an agent knows exactly what actions are dispatchable. It distinguishes itself from ha_config_set_helper, ha_remove_helpers_integrations and ha_get_integration by name, which is unusually strong sibling separation.

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?

Includes a dedicated WHEN NOT TO USE block that routes helpers, config subentries, the 'otp' helper, and entry removal to their correct siblings, plus how to obtain entry IDs and how to inspect options fields before an update. The mode list itself is a when-to-use map keyed to parameter combinations.

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