Skip to main content
Glama

discover_nanoleaf

Find Nanoleaf smart lights on your local network to enable control through the MCP server for managing brightness, colors, and effects.

Instructions

Discover Nanoleaf devices on the network

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'discover_nanoleaf' tool call. It invokes NanoleafClient.discover() to find devices on the network, sets the primary device if found, and returns a formatted response with discovered devices or error messages.
    case 'discover_nanoleaf':
      try {
        const devices = await NanoleafClient.discover();
        if (devices.length > 0) {
          primaryDevice = new NanoleafClient(devices[0]);
          return {
            content: [
              {
                type: 'text',
                text: `Found ${devices.length} Nanoleaf device(s): ${JSON.stringify(devices, null, 2)}`,
              },
            ],
          };
        } else {
          return {
            content: [
              {
                type: 'text',
                text: 'No Nanoleaf devices found on the network',
              },
            ],
          };
        }
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error during discovery: ${error}`,
            },
          ],
        };
      }
  • Core discovery logic using SSDP (Simple Service Discovery Protocol) via node-ssdp to find Nanoleaf devices on the local network by searching for 'upnp:rootdevice' and filtering for 'nanoleaf' in ST header.
    static async discover(): Promise<NanoleafDevice[]> {
      return new Promise((resolve, reject) => {
        const client = new Client();
        const devices: NanoleafDevice[] = [];
        const timeout = setTimeout(() => {
          client.stop();
          resolve(devices);
        }, 5000);
    
        client.on('response', (headers: any, statusCode: number, rinfo: any) => {
          if (headers.ST && headers.ST.includes('nanoleaf')) {
            const location = headers.LOCATION;
            if (location) {
              const url = new URL(location);
              devices.push({
                ip: url.hostname,
                port: parseInt(url.port) || 16021,
              });
            }
          }
        });
    
        client.search('upnp:rootdevice');
      });
    }
  • src/index.ts:142-148 (registration)
    Registration of the 'discover_nanoleaf' tool in the list of available tools, including its description and empty input schema (no parameters required).
      name: 'discover_nanoleaf',
      description: 'Discover Nanoleaf devices on the network',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Type definition for NanoleafDevice interface used in the discovery result.
    export interface NanoleafDevice {
      ip: string;
      port: number;
      protocol?: string;
      authToken?: string;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Discover') but lacks details on how it works (e.g., network scanning method, timeouts, permissions required), what it returns (e.g., list of devices, errors), or side effects (e.g., network traffic). This is a significant gap for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that directly states the tool's purpose with no wasted words. It is front-loaded and efficiently communicates the core functionality, making it easy for an agent to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the discovery entails (e.g., returns device IDs, IPs), how results are formatted, or error handling. For a tool in a suite with multiple device interaction siblings, more context on its role and output is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and it appropriately doesn't mention any. A baseline score of 4 is applied as it meets the requirement for a parameterless tool without unnecessary information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Discover') and resource ('Nanoleaf devices on the network'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'connect_to_ip' or 'get_nanoleaf_info', which might involve device discovery or information retrieval, leaving some ambiguity about its unique role.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., network setup), when it's appropriate (e.g., initial setup vs. runtime), or how it relates to siblings like 'connect_to_ip' or 'authorize_nanoleaf', leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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