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), });

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