Skip to main content
Glama

Call a service (control a device)

ha_call_service

Call a Home Assistant service in a given domain to control devices, run scripts, trigger automations, or change entity states via the REST API.

Instructions

Control Home Assistant: run a service in a domain. POST /api/services/{domain}/{service}. Args: domain (e.g. "light"), service (e.g. "turn_on"), data (service payload — usually {"entity_id": "..."}); extra keys go in data, e.g. {"entity_id":"light.study","brightness_pct":40}. Common: light.turn_on/turn_off/toggle, switch.toggle, cover.open_cover/close_cover/set_cover_position, climate.set_temperature/set_hvac_mode, media_player.media_play_pause/volume_set, fan.turn_on, lock.lock/unlock, vacuum.start, script.turn_on, automation.trigger, scene.turn_on, notify.send_message, homeassistant.turn_off (whole domain or entity). Returns: the states that changed while the service ran, plus the service response when the service supports it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNoService data, usually including "entity_id"
domainYesService domain, e.g. "light"
serviceYesService name, e.g. "turn_on"
returnResponseNoAsk the service to return response data, if it supports it

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnly=false, openWorld=true, idempotent=false, destructive=false. The description adds value beyond this: it discloses the return semantics ('the states that changed while the service ran'), the POST path, and that extra keys are merged into the data payload. It notably omits any warning that targets like homeassistant.turn_off can affect an entire domain, a real side effect given destructiveHint=false.

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 endpoint, then args and examples; nearly every sentence earns its place. The long enumeration of common services is borderline verbose but serves as a genuinely useful reference for an open-world tool, so it is defensible rather than wasteful.

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 mutation tool with a nested free-form payload, open-world annotations, and no output schema, the description is thorough: it covers inputs, the data-merging rule, and return behavior. Remaining gaps are error/permission behavior and the risk of domain-wide targets, which a complete definition would surface.

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. The description goes further by giving concrete example values per parameter (domain 'light', service 'turn_on') and, importantly, explaining the merge semantics of the loosely-typed 'data' object and the optional returnResponse behavior.

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+resource ('run a service in a domain') plus the concrete endpoint, and its scope is clearly distinct from siblings like ha_call_api and ha_fire_event. An agent can identify this as the high-level device-control entry point 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 Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description conveys the intended use via the endpoint and a long list of common domain.service pairs, which implicitly tells the agent this is the tool for controlling devices. However, it never explicitly contrasts with alternatives such as ha_call_api or ha_fire_event, so routing guidance is implied rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.