Skip to main content
Glama

authorize_nanoleaf

Authorize connection to Nanoleaf smart lights in pairing mode through the Nanoleaf MCP Server for seamless integration and control.

Instructions

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

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • Tool handler for 'authorize_nanoleaf' that checks if a device is connected and calls authorize() on NanoleafClient, returning success or error message.
    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}`, }, ], }; }
  • src/index.ts:168-175 (registration)
    Registration of the 'authorize_nanoleaf' tool in the listTools response, including name, description, and empty input schema.
    { name: 'authorize_nanoleaf', description: 'Authorize connection to Nanoleaf device (device must be in pairing mode)', inputSchema: { type: 'object', properties: {}, }, },
  • Core authorization logic in NanoleafClient class: sends POST to /new endpoint to obtain auth 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.'); } }

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