set_brightness
Adjust the brightness level of Nanoleaf smart lights from 0 to 100 percent using the MCP server for precise lighting control.
Instructions
Set the brightness of the Nanoleaf lights
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| brightness | Yes | Brightness level (0-100) |
Implementation Reference
- src/index.ts:81-96 (registration)Registration of the 'set_brightness' tool, including its description and input schema defining brightness as a number between 0-100.{ name: 'set_brightness', description: 'Set the brightness of the Nanoleaf lights', inputSchema: { type: 'object', properties: { brightness: { type: 'number', description: 'Brightness level (0-100)', minimum: 0, maximum: 100, }, }, required: ['brightness'], }, },
- src/index.ts:333-343 (handler)MCP tool handler for 'set_brightness': extracts brightness argument, calls NanoleafClient.setBrightness, and returns confirmation.case 'set_brightness': const brightness = request.params.arguments?.brightness as number; await primaryDevice.setBrightness(brightness); return { content: [ { type: 'text', text: `Brightness set to ${brightness}%`, }, ], };
- src/nanoleaf-client.ts:168-175 (helper)Core implementation of setBrightness in NanoleafClient: validates input range and sends HTTP PUT request to update device state.async setBrightness(brightness: number): Promise<void> { if (brightness < 0 || brightness > 100) { throw new Error('Brightness must be between 0 and 100'); } await this.httpClient.put(this.getAuthUrl('/state'), { brightness: { value: brightness } }); }