Skip to main content
Glama

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
NameRequiredDescriptionDefault
brightnessYesBrightness 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'],
      },
    },
  • 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}%`,
          },
        ],
      };
  • 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 }
      });
    }

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