Skip to main content
Glama
lenvolk
by lenvolk

list_scenes

Retrieve all available lighting scenes from your LIFX account to manage and apply preset configurations for smart lights.

Instructions

List all scenes available in the account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesLIFX API token

Implementation Reference

  • The handler for the 'list_scenes' tool. It extracts the LIFX token from arguments, calls makeLIFXRequest to fetch scenes from the '/scenes' endpoint, and returns a formatted text response listing the scenes with their names, UUIDs, state counts, and creation dates.
    case "list_scenes": {
      const { token } = args as { token: string };
      const scenes = await makeLIFXRequest("/scenes", { token });
    
      return {
        content: [
          {
            type: "text",
            text: `Found ${scenes.length} scenes:\n\n${scenes.map((scene: LIFXScene) =>
              `• ${scene.name} (${scene.uuid})\n  States: ${scene.states.length} lights\n  Created: ${new Date(scene.created_at * 1000).toLocaleDateString()}`
            ).join('\n\n')}`,
          },
        ],
      };
    }
  • src/index.ts:223-233 (registration)
    Registration of the 'list_scenes' tool in the listTools handler, defining its name, description, and input schema requiring a LIFX API token.
    {
      name: "list_scenes",
      description: "List all scenes available in the account",
      inputSchema: {
        type: "object",
        properties: {
          token: { type: "string", description: "LIFX API token" },
        },
        required: ["token"],
      },
    },
  • TypeScript interface definition for LIFXScene, used to type the response data in the list_scenes handler.
    interface LIFXScene {
      uuid: string;
      name: string;
      account: {
        uuid: string;
      };
      states: Array<{
        selector: string;
        power: string;
        brightness: number;
        color: {
          hue: number;
          saturation: number;
          kelvin: number;
        };
      }>;
      created_at: number;
      updated_at: number;
    }
  • Helper function used by list_scenes (and other tools) to make authenticated HTTP requests to the LIFX API.
    async function makeLIFXRequest(
      endpoint: string,
      options: {
        method?: string;
        body?: any;
        token: string;
      }
    ): Promise<any> {
      const { method = "GET", body, token } = options;
      
      const url = `${LIFX_API_BASE}${endpoint}`;
      const headers: Record<string, string> = {
        "Authorization": `Bearer ${token}`,
        "User-Agent": USER_AGENT,
      };
    
      if (body && (method === "POST" || method === "PUT")) {
        headers["Content-Type"] = "application/json";
      }
    
      try {
        const response = await fetch(url, {
          method,
          headers,
          body: body ? JSON.stringify(body) : undefined,
        });
    
        if (!response.ok) {
          const errorText = await response.text();
          throw new Error(`LIFX API error: ${response.status} ${response.statusText} - ${errorText}`);
        }
    
        // Some endpoints return empty responses
        const contentType = response.headers.get("content-type");
        if (contentType?.includes("application/json")) {
          return await response.json();
        }
        
        return await response.text();
      } catch (error) {
        throw new Error(`Failed to make LIFX API request: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
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 it 'lists' scenes, implying a read-only operation, but doesn't clarify if this requires authentication (though the schema shows a token parameter), what the output format is, or if there are pagination or rate limits. This leaves significant gaps for an agent to understand the tool's behavior.

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 without any unnecessary words. It's front-loaded and efficiently communicates the core functionality, making it easy for an agent to parse 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 output looks like (e.g., a list of scene objects), any authentication requirements implied by the token, or how this tool fits into the broader context of scene management with siblings like 'activate_scene'. For a tool with no structured behavioral data, more descriptive context is needed.

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

Parameters3/5

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

The input schema has 100% description coverage, with the 'token' parameter clearly documented as a 'LIFX API token'. The description doesn't add any additional meaning beyond this, such as explaining why the token is needed or how to obtain it. Given the high schema coverage, the baseline score of 3 is appropriate.

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 action ('List') and resource ('all scenes available in the account'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_lights' or 'activate_scene' beyond the resource type, which prevents a perfect score.

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. For example, it doesn't specify if this should be used before activating a scene with 'activate_scene' or how it relates to other listing tools like 'list_lights'. There's no mention of prerequisites or context for usage.

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

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