Skip to main content
Glama

get-lights

List all connected Philips Hue lights or retrieve details for a specific light by ID or room. Integrates with OpenHue MCP Server for easy light management via LLM interfaces.

Instructions

List all Hue lights or get details for a specific light

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lightIdNoOptional light ID or name to get specific light details
roomNoOptional room name to filter lights

Implementation Reference

  • The handler function for the 'get-lights' tool. Constructs a 'get light' OpenHue CLI command with optional lightId or room filters, appends --json, executes it using executeHueCommand, and returns the result as text content.
    case "get-lights": { let command = "get light"; if (args?.lightId) { command += ` "${args.lightId}"`; } if (args?.room) { command += ` --room "${args.room}"`; } command += " --json"; const result = await executeHueCommand(command); return { content: [ { type: "text", text: result, }, ], }; }
  • JSON input schema for the 'get-lights' tool, defining optional 'lightId' and 'room' string parameters.
    inputSchema: { type: "object", properties: { lightId: { type: "string", description: "Optional light ID or name to get specific light details", }, room: { type: "string", description: "Optional room name to filter lights", }, }, },
  • src/index.ts:82-98 (registration)
    Tool registration in the listTools handler, specifying name, description, and inputSchema for 'get-lights'.
    { name: "get-lights", description: "List all Hue lights or get details for a specific light", inputSchema: { type: "object", properties: { lightId: { type: "string", description: "Optional light ID or name to get specific light details", }, room: { type: "string", description: "Optional room name to filter lights", }, }, }, },
  • Helper function used by 'get-lights' handler to execute OpenHue CLI commands via Docker container, capturing stdout or throwing 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; } }
  • Helper to build Docker command for running openhue/cli with mounted config, used indirectly by get-lights via executeHueCommand.
    const buildDockerCommand = (command: string) => { const configPath = getConfigPath(); return `docker run -v "${configPath}:/.openhue" --rm openhue/cli ${command}`; };

Other Tools

Related 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/lsemenenko/openhue-mcp-server'

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