Skip to main content
Glama

set_brightness

Adjust the brightness level of Nanoleaf smart lights between 0 and 100 using the MCP server. Enables precise control through compatible clients for optimal lighting.

Instructions

Set the brightness of the Nanoleaf lights

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
brightnessYesBrightness level (0-100)

Implementation Reference

  • MCP tool handler for 'set_brightness': extracts brightness parameter, calls NanoleafClient.setBrightness, and returns success message.
    case 'set_brightness': const brightness = request.params.arguments?.brightness as number; await primaryDevice.setBrightness(brightness); return { content: [ { type: 'text', text: `Brightness set to ${brightness}%`, }, ], };
  • Input schema definition for the set_brightness tool, specifying brightness as a required 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:54-178 (registration)
    Registers the set_brightness tool in the MCP server's listTools handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: 'get_nanoleaf_info', description: 'Get information about the Nanoleaf device', inputSchema: { type: 'object', properties: {}, }, }, { name: 'turn_on_nanoleaf', description: 'Turn on the Nanoleaf lights', inputSchema: { type: 'object', properties: {}, }, }, { name: 'turn_off_nanoleaf', description: 'Turn off the Nanoleaf lights', inputSchema: { type: 'object', properties: {}, }, }, { 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'], }, }, { 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'], }, }, { name: 'set_effect', description: 'Set an effect on the Nanoleaf lights', inputSchema: { type: 'object', properties: { effect: { type: 'string', description: 'Name of the effect to apply', }, }, required: ['effect'], }, }, { name: 'get_effects', description: 'Get list of available effects', inputSchema: { type: 'object', properties: {}, }, }, { name: 'discover_nanoleaf', description: 'Discover Nanoleaf devices on the network', inputSchema: { type: 'object', properties: {}, }, }, { name: 'connect_to_ip', description: 'Connect to a Nanoleaf device at a specific IP address', inputSchema: { type: 'object', properties: { ip: { type: 'string', description: 'IP address of the Nanoleaf device', }, port: { type: 'number', description: 'Port number (default: 16021)', default: 16021, }, }, required: ['ip'], }, }, { name: 'authorize_nanoleaf', description: 'Authorize connection to Nanoleaf device (device must be in pairing mode)', inputSchema: { type: 'object', properties: {}, }, }, ], }; });
  • Core implementation of brightness setting in NanoleafClient class: validates input and sends PUT request to Nanoleaf API state endpoint.
    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 } }); }

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