activate-scene
Use this tool to activate a specific Philips Hue lighting scene by providing the scene name or ID, with optional room name and mode settings. Part of the OpenHue MCP Server for controlling lights via CLI.
Instructions
Activate a specific scene
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Optional scene mode | |
| name | Yes | Scene name or ID | |
| room | No | Optional room name for the scene |
Implementation Reference
- src/index.ts:328-346 (handler)Handler for 'activate-scene' tool: parses arguments using SceneActionSchema, constructs OpenHue CLI command to activate the scene, executes it via Docker, and returns a success message.case "activate-scene": { const params = SceneActionSchema.parse(args); let command = `set scene "${params.name}"`; if (params.room) { command += ` --room "${params.room}"`; } if (params.mode) { command += ` --action ${params.mode}`; } await executeHueCommand(command); return { content: [ { type: "text", text: `Successfully activated scene "${params.name}"`, }, ], }; }
- src/index.ts:44-48 (schema)Zod schema for validating input parameters of the 'activate-scene' tool: requires scene name, optional room and mode.const SceneActionSchema = z.object({ name: z.string(), room: z.string().optional(), mode: z.enum(["active", "dynamic", "static"]).optional(), });
- src/index.ts:195-217 (registration)Tool registration in ListTools response: defines name, description, and JSON input schema for 'activate-scene'.{ name: "activate-scene", description: "Activate a specific scene", inputSchema: { type: "object", properties: { name: { type: "string", description: "Scene name or ID", }, room: { type: "string", description: "Optional room name for the scene", }, mode: { type: "string", enum: ["active", "dynamic", "static"], description: "Optional scene mode", }, }, required: ["name"], }, },
- src/index.ts:64-76 (helper)Helper function to execute OpenHue commands via Docker, used by the 'activate-scene' handler.async function executeHueCommand(command: string): Promise<string> { try { const { stdout, stderr } = await execAsync(buildDockerCommand(command)); if (stderr) { console.error("Command error:", stderr); throw new Error(stderr); } return stdout; } catch (error) { console.error("Execution error:", error); throw error; } }