validate_color
Check if a color string is valid for use with LIFX smart lights before applying it to ensure proper lighting control.
Instructions
Validate a color string
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | LIFX API token | |
| color | Yes | Color string to validate |
Implementation Reference
- src/index.ts:465-477 (handler)The handler function for the 'validate_color' tool. It extracts the token and color from arguments, makes a request to the LIFX /color API endpoint to validate the color, and returns the result as text content.case "validate_color": { const { token, color } = args as { token: string; color: string }; const result = await makeLIFXRequest(`/color?color=${encodeURIComponent(color)}`, { token }); return { content: [ { type: "text", text: `Color validation result:\n${JSON.stringify(result, null, 2)}`, }, ], }; }
- src/index.ts:248-259 (registration)The registration of the 'validate_color' tool in the list_tools response, defining its name, description, and input schema.{ name: "validate_color", description: "Validate a color string", inputSchema: { type: "object", properties: { token: { type: "string", description: "LIFX API token" }, color: { type: "string", description: "Color string to validate" }, }, required: ["token", "color"], }, },
- src/index.ts:118-118 (schema)Zod schema definition for color strings, used as a reference for color format validation in tools.const ColorSchema = z.string().describe("Color string (e.g., 'blue', 'rgb:255,0,0', 'hue:120 saturation:1.0')");