Skip to main content
Glama

authorize_nanoleaf

Authorize connection to Nanoleaf smart lights by establishing secure pairing with devices currently in pairing mode.

Instructions

Authorize connection to Nanoleaf device (device must be in pairing mode)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'authorize_nanoleaf' tool. Checks if primaryDevice exists, calls authorize() on it, and returns appropriate success or error response.
    case 'authorize_nanoleaf': if (!primaryDevice) { return { content: [ { type: 'text', text: 'No device connected. Please run connect_to_ip or discover_nanoleaf first.', }, ], }; } try { const authToken = await primaryDevice.authorize(); return { content: [ { type: 'text', text: `Successfully authorized! Auth token: ${authToken.substring(0, 8)}... (truncated for security)`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Authorization failed: ${error}`, }, ], }; }
  • Input schema definition for the 'authorize_nanoleaf' tool, registered in the ListTools response. No input parameters required.
    { name: 'authorize_nanoleaf', description: 'Authorize connection to Nanoleaf device (device must be in pairing mode)', inputSchema: { type: 'object', properties: {}, }, },
  • Implementation of the authorize method in NanoleafClient class. Sends POST request to /new endpoint to obtain authentication token and stores it.
    async authorize(): Promise<string> { try { const response = await this.httpClient.post('/new'); const authToken = response.data.auth_token; this.device.authToken = authToken; return authToken; } catch (error) { throw new Error('Failed to authorize. Make sure to hold the power button on your Nanoleaf device for 5-7 seconds.'); } }

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