Skip to main content
Glama
lenvolk
by lenvolk

pulse_effect

Create a pulsing color effect on LIFX smart lights by cycling between colors with adjustable timing, brightness, and duration for dynamic lighting.

Instructions

Perform a pulse effect

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesLIFX API token
selectorNoSelector for filtering lights (default: 'all')
colorYesColor to pulse
from_colorNoStarting color
periodNoDuration of one cycle in seconds
cyclesNoNumber of cycles
persistNoPersist the final color
power_onNoTurn on if off
peakNoPeak brightness (0.0 to 1.0)

Implementation Reference

  • The main handler for the 'pulse_effect' tool. It extracts parameters from the input arguments, constructs the request body, makes a POST request to the LIFX API endpoint `/lights/{selector}/effects/pulse`, and returns a formatted success message with the API response.
    case "pulse_effect": {
      const { token, selector = "all", ...effectParams } = args as {
        token: string;
        selector?: string;
        color: string;
        from_color?: string;
        period?: number;
        cycles?: number;
        persist?: boolean;
        power_on?: boolean;
        peak?: number;
      };
    
      const body = Object.fromEntries(
        Object.entries(effectParams).filter(([_, value]) => value !== undefined)
      );
    
      const result = await makeLIFXRequest(`/lights/${selector}/effects/pulse`, {
        method: "POST",
        body,
        token,
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Pulse effect started for selector "${selector}". ${JSON.stringify(result, null, 2)}`,
          },
        ],
      };
    }
  • The input schema defining the parameters, types, descriptions, and required fields for the 'pulse_effect' tool.
    inputSchema: {
      type: "object",
      properties: {
        token: { type: "string", description: "LIFX API token" },
        selector: { type: "string", description: "Selector for filtering lights (default: 'all')" },
        color: { type: "string", description: "Color to pulse" },
        from_color: { type: "string", description: "Starting color" },
        period: { type: "number", minimum: 0.1, description: "Duration of one cycle in seconds" },
        cycles: { type: "number", minimum: 1, description: "Number of cycles" },
        persist: { type: "boolean", description: "Persist the final color" },
        power_on: { type: "boolean", description: "Turn on if off" },
        peak: { type: "number", minimum: 0, maximum: 1, description: "Peak brightness (0.0 to 1.0)" },
      },
      required: ["token", "color"],
    },
  • src/index.ts:204-222 (registration)
    The tool registration object that includes the name, description, and input schema, returned by the ListTools handler.
    {
      name: "pulse_effect",
      description: "Perform a pulse effect",
      inputSchema: {
        type: "object",
        properties: {
          token: { type: "string", description: "LIFX API token" },
          selector: { type: "string", description: "Selector for filtering lights (default: 'all')" },
          color: { type: "string", description: "Color to pulse" },
          from_color: { type: "string", description: "Starting color" },
          period: { type: "number", minimum: 0.1, description: "Duration of one cycle in seconds" },
          cycles: { type: "number", minimum: 1, description: "Number of cycles" },
          persist: { type: "boolean", description: "Persist the final color" },
          power_on: { type: "boolean", description: "Turn on if off" },
          peak: { type: "number", minimum: 0, maximum: 1, description: "Peak brightness (0.0 to 1.0)" },
        },
        required: ["token", "color"],
      },
    },

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/lenvolk/mcp-lifx'

If you have feedback or need assistance with the MCP directory API, please join our Discord server