Skip to main content
Glama
diverdown1964

Home Assistant MCP Server

call_service

Control Home Assistant smart home devices by calling services to turn on lights, adjust climate settings, or operate switches with specific parameters.

Instructions

Call a Home Assistant service (e.g., turn on a light, set climate)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesService domain (e.g., 'light', 'switch', 'climate')
serviceYesService name (e.g., 'turn_on', 'turn_off', 'set_temperature')
entity_idNoTarget entity ID
dataNoAdditional service data (e.g., brightness, temperature)

Implementation Reference

  • Switch case handler for 'call_service' tool that prepares service data and calls haClient.callService
    case "call_service": {
      const serviceData: any = {};
      if (args?.entity_id) {
        serviceData.entity_id = args.entity_id;
      }
      if (args?.data) {
        Object.assign(serviceData, args.data);
      }
    
      const result = await haClient.callService(
        args?.domain as string,
        args?.service as string,
        serviceData
      );
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:127-152 (registration)
    Tool registration for 'call_service' including name, description, and input schema
    {
      name: "call_service",
      description: "Call a Home Assistant service (e.g., turn on a light, set climate)",
      inputSchema: {
        type: "object",
        properties: {
          domain: {
            type: "string",
            description: "Service domain (e.g., 'light', 'switch', 'climate')",
          },
          service: {
            type: "string",
            description: "Service name (e.g., 'turn_on', 'turn_off', 'set_temperature')",
          },
          entity_id: {
            type: "string",
            description: "Target entity ID",
          },
          data: {
            type: "object",
            description: "Additional service data (e.g., brightness, temperature)",
          },
        },
        required: ["domain", "service"],
      },
    },
  • HomeAssistantClient method that performs the actual service call via the HA API
    async callService(domain: string, service: string, data: any = {}) {
      return this.fetch(`services/${domain}/${service}`, {
        method: "POST",
        body: JSON.stringify(data),
      });
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions calling services with examples but doesn't disclose critical behavioral traits: whether this is a mutation (likely yes, given examples), permission requirements, side effects (e.g., device state changes), error handling, or rate limits. For a tool that likely performs home automation actions, this is a significant gap in safety and operational context.

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 a single, efficient sentence with zero waste. It front-loads the core purpose and includes helpful examples in parentheses. Every word earns its place, making it easy to parse quickly.

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

Completeness2/5

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

Given the tool's complexity (4 parameters, likely mutative actions in home automation) and lack of annotations and output schema, the description is insufficient. It doesn't explain return values, error conditions, or the implications of calling services (e.g., irreversible changes). For a tool that could control physical devices, more context on safety and behavior is needed.

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%, so the schema fully documents all 4 parameters (domain, service, entity_id, data). The description adds no additional parameter semantics beyond what the schema provides (e.g., no extra syntax, format, or usage details). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Call') and resource ('a Home Assistant service'), with specific examples ('turn on a light, set climate'). It distinguishes from siblings like get_entity_state (which reads state) and list_entities/list_services (which list resources), but doesn't explicitly name them. The purpose is specific and actionable, though not maximally differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like get_entity_state or list_services. The description implies it's for executing actions (e.g., turning on lights), but lacks explicit when/when-not instructions or prerequisites. Usage is inferred from the examples, not stated.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/diverdown1964/HomeAssistant-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server