control-room
Manage room lighting by turning lights on or off, adjusting brightness, color, and temperature using the OpenHue MCP Server. Simplify control for Philips Hue systems.
Instructions
Control all lights in a room
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Turn room lights on or off | |
| brightness | No | Optional brightness level (0-100) | |
| color | No | Optional color name | |
| target | Yes | Room ID or name | |
| temperature | No | Optional color temperature in Mirek |
Input Schema (JSON Schema)
{
"properties": {
"action": {
"description": "Turn room lights on or off",
"enum": [
"on",
"off"
],
"type": "string"
},
"brightness": {
"description": "Optional brightness level (0-100)",
"maximum": 100,
"minimum": 0,
"type": "number"
},
"color": {
"description": "Optional color name",
"type": "string"
},
"target": {
"description": "Room ID or name",
"type": "string"
},
"temperature": {
"description": "Optional color temperature in Mirek",
"maximum": 500,
"minimum": 153,
"type": "number"
}
},
"required": [
"target",
"action"
],
"type": "object"
}
Implementation Reference
- src/index.ts:288-309 (handler)The main handler for the 'control-room' tool. It validates input using RoomActionSchema, constructs an OpenHue CLI command to control room lights (on/off, brightness, color, temperature), executes it via executeHueCommand, and returns a success message.case "control-room": { const params = RoomActionSchema.parse(args); let command = `set room "${params.target}" --${params.action}`; if (params.brightness !== undefined) { command += ` --brightness ${params.brightness}`; } if (params.color) { command += ` --color ${params.color}`; } if (params.temperature) { command += ` --temperature ${params.temperature}`; } await executeHueCommand(command); return { content: [ { type: "text", text: `Successfully set room "${params.target}" to ${params.action}`, }, ], }; }
- src/index.ts:36-42 (schema)Zod schema used to parse and validate the input arguments for the 'control-room' tool in the handler.const RoomActionSchema = z.object({ target: z.string(), action: z.enum(["on", "off"]), brightness: z.number().min(0).max(100).optional(), color: z.string().optional(), temperature: z.number().min(153).max(500).optional(), });
- src/index.ts:147-181 (registration)Tool registration in the ListTools handler, providing the tool's name, description, and JSON input schema for MCP clients.{ name: "control-room", description: "Control all lights in a room", inputSchema: { type: "object", properties: { target: { type: "string", description: "Room ID or name", }, action: { type: "string", enum: ["on", "off"], description: "Turn room lights on or off", }, brightness: { type: "number", minimum: 0, maximum: 100, description: "Optional brightness level (0-100)", }, color: { type: "string", description: "Optional color name", }, temperature: { type: "number", minimum: 153, maximum: 500, description: "Optional color temperature in Mirek", }, }, required: ["target", "action"], }, },
- src/index.ts:64-76 (helper)Helper function called by the handler to execute the constructed OpenHue CLI command via Docker.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; } }