Skip to main content
Glama

activate_scene

Activate a LIFX smart lighting scene to set specific colors, brightness, and effects across multiple lights simultaneously using a scene UUID.

Instructions

Activate a scene

Input Schema

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

Implementation Reference

  • Handler for the activate_scene tool. Extracts parameters, constructs request body, calls LIFX API to activate the scene, and returns success message with result.
    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)}`, }, ], }; }
  • Schema definition for activate_scene tool including input parameters validation.
    { 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"], }, },
  • Helper function used by activate_scene to make authenticated HTTP requests to LIFX API.
    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)}`); } }
  • Type definition for LIFX scenes used in related tools.
    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; }

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