Skip to main content
Glama
TheWhykiki

hass-mcp

by TheWhykiki

ha_area_lights_on

Turn on all lights in a specified area with optional brightness percentage and transition time.

Instructions

Turn on all lights in an area (by area_id).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
area_idYes
brightness_pctNo
transitionNo

Implementation Reference

  • The actual handler logic: turnOnAreaLights method that filters light entities by area_id and calls the Home Assistant 'light.turn_on' service with optional brightness_pct and transition params.
    async turnOnAreaLights(params: { area_id: string, brightness_pct?: number, transition?: number }) {
      const entries = await this.listEntityRegistry()
      const entityIds = entries
        .filter(e => e.area_id === params.area_id)
        .map(e => e.entity_id)
        .filter(eid => eid.startsWith('light.'))
    
      if (entityIds.length === 0)
        return { ok: true, changed: 0 }
    
      const data: Record<string, unknown> = {
        entity_id: entityIds,
      }
    
      if (typeof params.brightness_pct === 'number')
        data.brightness_pct = params.brightness_pct
    
      if (typeof params.transition === 'number')
        data.transition = params.transition
    
      await this.callService('light', 'turn_on', data)
    
      return { ok: true, changed: entityIds.length }
  • Zod schema for the tool input: area_id (required), brightness_pct (optional, 0-100), transition (optional number).
    export const AreaLightsOnInput = z.object({
      area_id: z.string().min(1),
      brightness_pct: z.number().min(0).max(100).optional(),
      transition: z.number().optional(),
    })
  • src/index.ts:169-179 (registration)
    Registration of the 'ha_area_lights_on' tool on the MCP server instance with name, description, input schema, and handler callback.
    server.tool(
      'ha_area_lights_on',
      'Turn on all lights in an area (by area_id).',
      AreaLightsOnInput.shape,
      async (input) => {
        const res = await ha.turnOnAreaLights(input)
        return {
          content: [{ type: 'text', text: JSON.stringify(res, null, 2) }],
        }
      },
    )
  • Import of AreaLightsOnInput schema from './tools.js' into the registration file.
    import {
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits like side effects, authorization needs, or whether it affects lights already on. The agent has no insight into mutability or safety.

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?

The description is a single sentence, efficient and to the point. It could remove 'by area_id' as redundant but is otherwise concise.

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?

With 3 parameters, no annotations, and no output schema, the description lacks details on return values, edge cases (e.g., empty area, some lights already on), and interaction with related tools. Incomplete for reliable use.

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?

Schema coverage is 0%, and the description only mentions area_id implicitly. brightness_pct and transition are not explained (units, behavior when omitted). The description adds minimal value beyond the schema.

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?

The description clearly states the action ('turn on'), resource ('all lights in an area'), and the key parameter ('area_id'). It distinguishes from sibling tools like ha_area_lights_off and ha_light_turn_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 mention of when to use this tool versus alternatives such as ha_light_turn_on for individual lights. No guidance on the optional parameters brightness_pct and transition.

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