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 {

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.7

TDQS

A3.7/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It states the core mutating action (turning on all lights) but does not disclose side effects, idempotency, permission requirements, or behavior for edge cases (e.g., no lights in area). This is adequate but minimal for a simple action.

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, front-loaded sentence with no filler. It conveys the essential purpose in nine words, making it exceptionally concise and easy to parse.

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 has 3 parameters, no annotations, no output schema, and zero schema description coverage, the one-sentence description is insufficient. It fails to explain the optional parameters (transition, brightness_pct) and any behavioral nuances, leaving significant gaps for an agent to correctly use the tool.

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 description coverage is 0%, so the description must compensate. It only clarifies the role of area_id implicitly, but transition and brightness_pct are left completely unexplained. The schema provides types/constraints but no semantic meaning, so the description adds minimal value beyond echoing the parameter name.

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'), the resource ('all lights in an area'), and the key qualifier ('by area_id'), which distinguishes it from sibling tools like ha_light_turn_on (single light) and ha_area_lights_off (turning off).

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

Usage Guidelines4/5

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

The description implies usage context: this is for area-wide light control, distinct from individual light control. However, it does not explicitly state alternatives or exclusions, so it falls short of a perfect score but provides clear enough context.

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