Skip to main content
Glama

set_color

Change Nanoleaf smart light colors by specifying hue and saturation values to customize lighting ambiance in any space.

Instructions

Set the color of the Nanoleaf lights

Input Schema

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

Implementation Reference

  • MCP server handler for 'set_color' tool: extracts hue and saturation arguments and calls NanoleafClient.setColor method
    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}`, }, ], };
  • Input schema defining required hue (0-360) and saturation (0-100) parameters for the set_color tool
    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'], },
  • src/index.ts:97-118 (registration)
    Registration of the 'set_color' tool in the ListTools response, including name, description, and schema
    { 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'], }, },
  • NanoleafClient helper method implementing the actual HTTP API call to set hue and saturation on the device state
    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 } }); }

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