Skip to main content
Glama
deepakkumardewani

Color Scheme Generator MCP Server

generate_monochrome_light_scheme

Create a light monochrome color scheme from a seed color for design projects. Specify a color and optionally the number of shades to generate.

Instructions

Generates a light monochrome color scheme

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorYesThe seed color in hex (098765), RGB (0,71,171), or HSL (215,100%,34%) format
countNoNumber of colors to generate (3-10, default: 5)

Implementation Reference

  • The async handler function for the 'generate_monochrome_light_scheme' tool. It extracts color and count from args, calls the generateColorScheme helper with 'monochrome-light' mode, and returns the result as JSON-formatted text content.
    async (args) => {
      const { color, count } = args;
      const result = await generateColorScheme(
        color,
        "monochrome-light",
        count
      );
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Shared Zod schema defining the input parameters for all color scheme tools, including color string and optional count.
    const colorSchemeInputShape = {
      color: z
        .string()
        .describe(
          "The seed color in hex (098765), RGB (0,71,171), or HSL (215,100%,34%) format"
        ),
      count: z
        .number()
        .int()
        .min(3)
        .max(10)
        .default(5)
        .optional()
        .describe("Number of colors to generate (3-10, default: 5)"),
    };
  • The registration function that registers the tool using server.tool, specifying name, description, input schema, and handler function.
    function registerMonochromeLightScheme() {
      server.tool(
        "generate_monochrome_light_scheme",
        "Generates a light monochrome color scheme",
        colorSchemeInputShape,
        async (args) => {
          const { color, count } = args;
          const result = await generateColorScheme(
            color,
            "monochrome-light",
            count
          );
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        }
      );
    }
  • Core helper function that parses the seed color, constructs URL for The Color API, fetches the scheme, formats the colors with hex/rgb/hsl/name, and returns structured result.
    async function generateColorScheme(
      color: string,
      mode: string,
      count: number = 5
    ) {
      const { param, value } = parseColorInput(color);
      const url = `https://www.thecolorapi.com/scheme?${param}=${value}&mode=${mode}&count=${count}&format=json`;
    
      try {
        const response = await fetch(url);
        if (!response.ok) {
          throw new Error(
            `Color API request failed: ${response.status} ${response.statusText}`
          );
        }
    
        const data: any = await response.json();
    
        if (!data.colors || !Array.isArray(data.colors)) {
          throw new Error("Invalid response from Color API");
        }
    
        // Format the response for better readability
        const colors = data.colors.map((color: any, index: number) => ({
          position: index + 1,
          hex: color.hex?.value || "N/A",
          rgb: color.rgb
            ? `rgb(${color.rgb.r}, ${color.rgb.g}, ${color.rgb.b})`
            : "N/A",
          hsl: color.hsl
            ? `hsl(${color.hsl.h}, ${color.hsl.s}%, ${color.hsl.l}%)`
            : "N/A",
          name: color.name?.value || "Unknown",
        }));
    
        return {
          scheme_mode: mode,
          seed_color: data.seed?.hex?.value || value,
          color_count: colors.length,
          colors: colors,
        };
      } catch (error) {
        console.error(`Error generating ${mode} color scheme:`, error);
        throw error;
      }
    }
  • Supporting helper to parse input color string into API-compatible {param, value} for hex, rgb, or hsl formats.
    function parseColorInput(color: string): { param: string; value: string } {
      const cleanColor = color.trim();
    
      // Check for hex format
      if (cleanColor.startsWith("#")) {
        return { param: "hex", value: cleanColor.substring(1) };
      } else if (/^[0-9A-Fa-f]{6}$/.test(cleanColor)) {
        return { param: "hex", value: cleanColor };
      }
    
      // Check for RGB format
      if (
        cleanColor.toLowerCase().includes("rgb") ||
        /^\d+,\d+,\d+$/.test(cleanColor)
      ) {
        const rgbMatch = cleanColor.match(/(\d+),\s*(\d+),\s*(\d+)/);
        if (rgbMatch) {
          return {
            param: "rgb",
            value: `${rgbMatch[1]},${rgbMatch[2]},${rgbMatch[3]}`,
          };
        }
      }
    
      // Check for HSL format
      if (cleanColor.toLowerCase().includes("hsl") || cleanColor.includes("%")) {
        const hslMatch = cleanColor.match(/(\d+),\s*(\d+)%,\s*(\d+)%/);
        if (hslMatch) {
          return {
            param: "hsl",
            value: `${hslMatch[1]},${hslMatch[2]}%,${hslMatch[3]}%`,
          };
        }
      }
    
      // Default to hex if format is unclear
      return { param: "hex", value: cleanColor.replace("#", "") };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but lacks details on output format, error handling, or any behavioral traits like performance or constraints. This leaves significant gaps for an agent to understand how to use it effectively.

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, efficient sentence with no wasted words. It is front-loaded and directly states the tool's purpose, making it easy 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 tool returns (e.g., a list of colors, a scheme object) or any behavioral aspects, which are crucial for an agent to invoke it correctly in a broader context.

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 input schema already fully documents the parameters. The description adds no additional meaning beyond what the schema provides, such as explaining the relationship between 'color' and 'count' or typical use cases. Baseline 3 is appropriate when the schema handles parameter documentation.

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 ('generates') and resource ('light monochrome color scheme'), making it understandable. However, it doesn't explicitly differentiate from its sibling 'generate_monochrome_scheme' or 'generate_monochrome_dark_scheme', which would be needed for 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. With multiple sibling tools for generating color schemes, there is no mention of specific contexts, exclusions, or comparisons to help an agent choose appropriately.

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/deepakkumardewani/color-scheme-mcp'

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