get-rooms
Retrieve details of all rooms or a specific room in your Philips Hue setup using the OpenHue MCP Server. Ideal for managing and controlling room-specific lighting configurations.
Instructions
List all rooms or get details for a specific room
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| roomId | No | Optional room ID or name to get specific room details |
Implementation Reference
- src/index.ts:271-286 (handler)Handler for the 'get-rooms' tool. Constructs an OpenHue 'get room' command, optionally including a specific roomId, appends '--json', executes it using executeHueCommand, and returns the result as text content.case "get-rooms": { let command = "get room"; if (args?.roomId) { command += ` "${args.roomId}"`; } command += " --json"; const result = await executeHueCommand(command); return { content: [ { type: "text", text: result, }, ], }; }
- src/index.ts:134-146 (registration)Registration of the 'get-rooms' tool in the ListTools response, including its name, description, and input schema (optional roomId string).{ name: "get-rooms", description: "List all rooms or get details for a specific room", inputSchema: { type: "object", properties: { roomId: { type: "string", description: "Optional room ID or name to get specific room details", }, }, }, },
- src/index.ts:64-76 (helper)Helper function used by get-rooms (and other tools) to execute OpenHue Docker commands and return stdout or throw errors.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; } }