Skip to main content
Glama

set_color

Adjust the hue and saturation of Nanoleaf smart lights directly through the MCP server. Specify hue (0-360) and saturation (0-100) values for precise color customization.

Instructions

Set the color of the Nanoleaf lights

Input Schema

NameRequiredDescriptionDefault
hueYesHue value (0-360)
saturationYesSaturation value (0-100)

Input Schema (JSON Schema)

{ "properties": { "hue": { "description": "Hue value (0-360)", "maximum": 360, "minimum": 0, "type": "number" }, "saturation": { "description": "Saturation value (0-100)", "maximum": 100, "minimum": 0, "type": "number" } }, "required": [ "hue", "saturation" ], "type": "object" }

Implementation Reference

  • MCP tool handler for 'set_color' that extracts hue and saturation from arguments and calls primaryDevice.setColor
    case 'set_color': const hue = request.params.arguments?.hue as number; const saturation = request.params.arguments?.saturation as number; await primaryDevice.setColor(hue, saturation); return { content: [ { type: 'text', text: `Color set to hue: ${hue}, saturation: ${saturation}`, }, ], };
  • src/index.ts:97-118 (registration)
    Registration of the 'set_color' tool in the listTools response, including input schema definition
    { name: 'set_color', description: 'Set the color of the Nanoleaf lights', inputSchema: { type: 'object', properties: { hue: { type: 'number', description: 'Hue value (0-360)', minimum: 0, maximum: 360, }, saturation: { type: 'number', description: 'Saturation value (0-100)', minimum: 0, maximum: 100, }, }, required: ['hue', 'saturation'], }, },
  • Implementation of setColor method in NanoleafClient that sends HTTP PUT request to update hue and saturation on the device
    async setColor(hue: number, saturation: number): Promise<void> { if (hue < 0 || hue > 360) { throw new Error('Hue must be between 0 and 360'); } if (saturation < 0 || saturation > 100) { throw new Error('Saturation must be between 0 and 100'); } await this.httpClient.put(this.getAuthUrl('/state'), { hue: { value: hue }, sat: { value: saturation } }); }

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/srnetadmin/nanoleaf-mcp-server'

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