Skip to main content
Glama

generate_color_variations

Generate tints, shades, and tones from a base color using mathematical precision for design consistency and palette expansion.

Instructions

Generate tints, shades, and tones of a base color with mathematical precision. Tints add white, shades add black, and tones add gray.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_colorYesBase color for generating variations
variation_typeYesType of variations to generate
stepsNoNumber of variation steps (3-20)
intensityNoVariation intensity percentage (0-100)

Implementation Reference

  • The ToolHandler implementation for 'generate_color_variations' tool, defining name, description, input schema, and the handler function.
    export const generateColorVariationsTool: ToolHandler = {
      name: 'generate_color_variations',
      description:
        'Generate tints, shades, and tones of a base color with mathematical precision. Tints add white, shades add black, and tones add gray.',
      parameters: {
        type: 'object',
        properties: {
          base_color: {
            type: 'string',
            description: 'Base color for generating variations',
          },
          variation_type: {
            type: 'string',
            enum: ['tints', 'shades', 'tones', 'all'],
            description: 'Type of variations to generate',
          },
          steps: {
            type: 'number',
            minimum: 3,
            maximum: 20,
            default: 10,
            description: 'Number of variation steps (3-20)',
          },
          intensity: {
            type: 'number',
            minimum: 0,
            maximum: 100,
            default: 50,
            description: 'Variation intensity percentage (0-100)',
          },
        },
        required: ['base_color', 'variation_type'],
      },
      handler: generateVariationsHandler,
    };
  • Joi validation schema used internally for parameter validation in the handler.
    const generateVariationsSchema = Joi.object({
      base_color: Joi.string().required().messages({
        'string.empty': 'Base color is required',
      }),
      variation_type: Joi.string()
        .valid('tints', 'shades', 'tones', 'all')
        .required()
        .messages({
          'any.only': 'Variation type must be one of: tints, shades, tones, all',
        }),
      steps: Joi.number().integer().min(3).max(20).default(10).messages({
        'number.min': 'Minimum 3 steps required',
        'number.max': 'Maximum 20 steps allowed',
      }),
      intensity: Joi.number().min(0).max(100).default(50).messages({
        'number.min': 'Intensity must be between 0 and 100',
        'number.max': 'Intensity must be between 0 and 100',
      }),
    });
  • Registration of the generate_color_variations tool into the central tool registry.
    toolRegistry.registerTool(generateColorVariationsTool);
  • Helper function that generates tint variations by progressively increasing lightness from the base color.
    function generateTints(
      baseColor: UnifiedColor,
      steps: number,
      intensity: number
    ): UnifiedColor[] {
      const tints: UnifiedColor[] = [];
      const hsl = baseColor.hsl;
    
      // Generate tints by increasing lightness towards white
      for (let i = 0; i < steps; i++) {
        const factor = (i / (steps - 1)) * (intensity / 100);
        const newLightness = hsl.l + (100 - hsl.l) * factor;
    
        try {
          const tint = UnifiedColor.fromHsl(
            hsl.h,
            hsl.s,
            Math.min(100, Math.max(0, newLightness)),
            hsl.a
          );
          tints.push(tint);
        } catch {
          // Skip invalid colors
          continue;
        }
      }
    
      return tints;
    }
  • Helper function that generates shade variations by progressively decreasing lightness from the base color.
    function generateShades(
      baseColor: UnifiedColor,
      steps: number,
      intensity: number
    ): UnifiedColor[] {
      const shades: UnifiedColor[] = [];
      const hsl = baseColor.hsl;
    
      // Generate shades by decreasing lightness towards black
      for (let i = 0; i < steps; i++) {
        const factor = (i / (steps - 1)) * (intensity / 100);
        const newLightness = hsl.l * (1 - factor);
    
        try {
          const shade = UnifiedColor.fromHsl(
            hsl.h,
            hsl.s,
            Math.min(100, Math.max(0, newLightness)),
            hsl.a
          );
          shades.push(shade);
        } catch {
          // Skip invalid colors
          continue;
        }
      }
    
      return shades;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only explains the conceptual approach ('tints add white, shades add black, tones add gray'). It doesn't disclose behavioral traits like output format, whether it's deterministic, performance characteristics, or error handling for invalid base colors.

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 perfectly concise with two sentences that each earn their place: the first states the core function, the second explains the three variation types. No wasted words and front-loaded with the main purpose.

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

Completeness3/5

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

For a tool with 4 parameters, 100% schema coverage, but no annotations or output schema, the description is minimally adequate. It explains what the tool does conceptually but lacks information about output format, error conditions, or practical usage examples that would help an agent use it effectively.

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?

Schema description coverage is 100%, so the baseline is 3. The description adds some context by explaining what tints, shades, and tones mean conceptually, but doesn't provide additional parameter semantics beyond what's already documented in the schema descriptions.

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

Purpose5/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 specific verbs ('generate tints, shades, and tones') and resource ('base color'), and distinguishes it from siblings by focusing on mathematical color variation generation rather than analysis, conversion, or export functions.

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 like 'generate_harmony_palette', 'mix_colors', or other color generation siblings. It explains what the tool does but not when it's the appropriate choice.

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/keyurgolani/ColorMcp'

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