Skip to main content
Glama
TheWhykiki

hass-mcp

by TheWhykiki

ha_call_service

Call any Home Assistant service by providing domain, service, and optional data payload to trigger automations or control devices.

Instructions

Call a Home Assistant service (domain/service) with data payload.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYes
serviceYes
dataNo

Implementation Reference

  • MCP tool registration and handler for 'ha_call_service'. Calls ha.callService with domain, service, and data, returning JSON acknowledgment.
    server.tool(
      'ha_call_service',
      'Call a Home Assistant service (domain/service) with data payload.',
      CallServiceInput.shape,
      async (input) => {
        const res = await ha.callService(input.domain, input.service, input.data)
        return {
          content: [{ type: 'text', text: JSON.stringify(res, null, 2) }],
        }
      },
  • Zod schema definition for CallServiceInput: domain (string), service (string), data (optional record).
    export const CallServiceInput = z.object({
      domain: z.string().min(1),
      service: z.string().min(1),
      data: z.record(z.unknown()).default({}),
    })
  • HomeAssistantClient.callService method that delegates to home-assistant-js-websocket's callService and returns { ok: true }.
    async callService(domain: string, service: string, data: Record<string, unknown>) {
      const connection = await this.ensureConnected()
    
      // callService returns void in the library; we return a small acknowledgement
      await callService(connection, domain, service, data)
      return { ok: true }
    }
  • src/index.ts:205-214 (registration)
    Registration of 'ha_call_service' tool on the MCP server via server.tool().
    server.tool(
      'ha_call_service',
      'Call a Home Assistant service (domain/service) with data payload.',
      CallServiceInput.shape,
      async (input) => {
        const res = await ha.callService(input.domain, input.service, input.data)
        return {
          content: [{ type: 'text', text: JSON.stringify(res, null, 2) }],
        }
      },
Behavior2/5

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

With no annotations provided, the description carries the full burden. It only states 'call' without any disclosure of side effects, permissions, error handling, or return behavior, which is insufficient for safe invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, concise but lacks structure. It is not front-loaded with key information like which services are callable or how to construct the payload.

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 absence of output schema, annotations, and rich parameter descriptions, the description is incomplete. It does not explain success/failure outcomes, return values, or required permissions.

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

Parameters2/5

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

The description mentions domain/service and data payload but adds no meaning beyond the input schema. Since schema description coverage is 0%, the description fails to compensate by explaining the purpose or constraints of the parameters.

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 it calls a Home Assistant service with domain/service and data payload. It is specific about what it does, but does not differentiate from sibling tools that are more specific, such as ha_light_turn_on or ha_area_lights_on.

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 generic tool versus the specific sibling tools. The description lacks any mention of context or alternatives, leaving the agent without decision support.

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/TheWhykiki/hass-mcp'

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