Skip to main content
Glama
lenvolk
by lenvolk

activate_scene

Apply a saved lighting scene to LIFX smart lights by specifying the scene UUID and duration for transition.

Instructions

Activate a scene

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesLIFX API token
scene_uuidYesScene UUID
durationNoDuration in seconds
fastNoFast mode (skip confirmation)

Implementation Reference

  • src/index.ts:234-247 (registration)
    Registration of the activate_scene tool in the ListToolsRequestSchema handler. Includes the tool name, description, and JSON input schema defining parameters: token (required), scene_uuid (required), duration (optional), fast (optional).
    {
      name: "activate_scene",
      description: "Activate a scene",
      inputSchema: {
        type: "object",
        properties: {
          token: { type: "string", description: "LIFX API token" },
          scene_uuid: { type: "string", description: "Scene UUID" },
          duration: { type: "number", minimum: 0, description: "Duration in seconds" },
          fast: { type: "boolean", description: "Fast mode (skip confirmation)" },
        },
        required: ["token", "scene_uuid"],
      },
    },
  • The core handler logic for the activate_scene tool within the CallToolRequestSchema switch statement. Extracts arguments, builds the request body from optional duration and fast params, invokes makeLIFXRequest to PUT /scenes/scene_id:{scene_uuid}/activate, and returns success message with API response.
    case "activate_scene": {
      const { token, scene_uuid, duration, fast } = args as {
        token: string;
        scene_uuid: string;
        duration?: number;
        fast?: boolean;
      };
    
      const body = Object.fromEntries(
        Object.entries({ duration, fast }).filter(([_, value]) => value !== undefined)
      );
    
      const result = await makeLIFXRequest(`/scenes/scene_id:${scene_uuid}/activate`, {
        method: "PUT",
        body,
        token,
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Scene activated successfully. ${JSON.stringify(result, null, 2)}`,
          },
        ],
      };
    }
  • Shared helper function makeLIFXRequest used by the activate_scene handler (and all other tools) to perform authenticated HTTP requests to the LIFX API, handling headers, JSON body, error checking, and response parsing.
    async function makeLIFXRequest(
      endpoint: string,
      options: {
        method?: string;
        body?: any;
        token: string;
      }
    ): Promise<any> {
      const { method = "GET", body, token } = options;
      
      const url = `${LIFX_API_BASE}${endpoint}`;
      const headers: Record<string, string> = {
        "Authorization": `Bearer ${token}`,
        "User-Agent": USER_AGENT,
      };
    
      if (body && (method === "POST" || method === "PUT")) {
        headers["Content-Type"] = "application/json";
      }
    
      try {
        const response = await fetch(url, {
          method,
          headers,
          body: body ? JSON.stringify(body) : undefined,
        });
    
        if (!response.ok) {
          const errorText = await response.text();
          throw new Error(`LIFX API error: ${response.status} ${response.statusText} - ${errorText}`);
        }
    
        // Some endpoints return empty responses
        const contentType = response.headers.get("content-type");
        if (contentType?.includes("application/json")) {
          return await response.json();
        }
        
        return await response.text();
      } catch (error) {
        throw new Error(`Failed to make LIFX API request: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • TypeScript interface definition for LIFXScene, used in related tools like list_scenes, providing structure for scene data relevant to activate_scene.
    interface LIFXScene {
      uuid: string;
      name: string;
      account: {
        uuid: string;
      };
      states: Array<{
        selector: string;
        power: string;
        brightness: number;
        color: {
          hue: number;
          saturation: number;
          kelvin: number;
        };
      }>;
      created_at: number;
      updated_at: number;
    }
Behavior1/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 of behavioral disclosure. 'Activate a scene' implies a write operation that changes lighting states, but it doesn't describe what activation entails (e.g., whether it overrides current settings, requires authentication, has side effects like network calls, or returns confirmation). For a mutation tool with zero annotation coverage, this lack of detail is a critical gap.

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 extremely concise at three words, with no wasted text. However, this brevity borders on under-specification rather than efficient communication, as it omits necessary context. It's front-loaded but lacks substance, earning a high score for structure but not full marks due to the risk of being too minimal.

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 complexity of a scene activation tool (likely involving API calls and lighting changes), no annotations, no output schema, and a sparse description, this is incomplete. The description doesn't cover what happens upon activation, error conditions, or return values, leaving the agent with significant uncertainty. It fails to provide adequate context for safe and effective use.

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%, with all parameters documented in the input schema (token, scene_uuid, duration, fast). The description adds no meaning beyond this, as it doesn't explain parameter interactions (e.g., how duration and fast mode affect activation) or provide examples. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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

Purpose2/5

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

The description 'Activate a scene' is a tautology that merely restates the tool name without adding specificity. It doesn't explain what 'activate' means in this context (e.g., applying lighting presets, triggering effects) or distinguish this tool from siblings like 'set_state' or 'breathe_effect' that might also change lighting states. The purpose remains vague beyond the basic verb-noun pairing.

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

Usage Guidelines1/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. It doesn't mention prerequisites (e.g., needing an existing scene), exclusions (e.g., not for individual lights), or comparisons to siblings like 'set_state' for direct light control or 'list_scenes' for discovery. The agent must infer usage from the name alone, which is insufficient for informed selection.

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/lenvolk/mcp-lifx'

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