Skip to main content
Glama

Toggle an entity

entities_toggle

Flips a Home Assistant entity between on and off by calling its domain's toggle action. Use when the desired end state is unknown or irrelevant and you only need to reverse its current state.

Instructions

Toggle an entity between on and off by calling its domain's toggle action.

Calls <domain>.toggle with {"entity_id": entity_id} over HTTP; the resulting state depends on the entity's current state, so repeating this call flips it back and forth.

Use when: the desired end state is unknown or irrelevant, only "flip it". Not for: a deterministic on/off — use entities_turn_on/entities_turn_off. Returns: the list of changed states from Home Assistant.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYesFull entity ID to toggle, e.g. 'switch.fan'.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.25.1
    • addedInput schema / properties / entity_id / description
      Added value: +"Full entity ID to toggle, e.g. 'switch.fan'."
  2. First observedv0.3.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations declare non-idempotent, non-destructive, closed-world, but the description adds the reason: the resulting state depends on the current state so repeated calls flip back and forth. It also discloses the underlying mechanism (calls `<domain>.toggle` over HTTP with `{entity_id}`) and that it returns changed states, which annotations alone do not convey.

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?

Front-loaded one-line purpose, then mechanism, then a labeled 'Use when / Not for / Returns' block. Every sentence carries distinct information with no redundancy.

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 one-parameter entity control tool with annotations covering safety hints and an output schema present, the description supplies everything needed: purpose, non-idempotent behavior, selection criteria, and the underlying service call.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and entity_id is fully documented in the schema, including the 'switch.fan' example. The description only restates the parameter in the payload shape, adding no meaning beyond the schema, so the baseline of 3 applies.

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 ('Toggle an entity between on and off') and explicitly frames it against the domain toggle action. An agent can distinguish it from entities_turn_on/entities_turn_off without opening any 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?

Explicit 'Use when: the desired end state is unknown or irrelevant, only flip it' plus 'Not for: a deterministic on/off — use entities_turn_on/entities_turn_off'. Both the when and the alternative are named, leaving nothing 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