Skip to main content
Glama

Change Model Color

change_model_color

Update the color of a 3D model in the scene using hex codes or predefined Apple crayon color names.

Instructions

Change the color of the 3D model in the scene

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorYesHex color code (e.g., "#ff0000") or Apple crayon color name (e.g., "maraschino", "turquoise", "lemon"). Available colors: licorice, lead, tungsten, iron, steel, tin, nickel, aluminum, magnesium, silver, mercury, snow, cayenne, mocha, asparagus, fern, clover, moss, teal, ocean, midnight, eggplant, plum, maroon, maraschino, tangerine, lemon, lime, spring, sea foam, turquoise, aqua, blueberry, grape, magenta, strawberry, salmon, cantaloupe, banana, honeydew, flora, spindrift, ice, sky, orchid, lavender, bubblegum, carnation

Implementation Reference

  • server.js:410-448 (registration)
    Registration of the 'change_model_color' tool with schema (color input validated via Zod/colorSchema) and the handler function that normalizes the color via normalizeColorToHex and routes the 'changeColor' command to the browser session.
    mcpServer.registerTool(
      'change_model_color',
      {
        title: 'Change Model Color',
        description: 'Change the color of the 3D model in the scene',
        inputSchema: {
          color: colorSchema
        }
      },
      async ({ color }) => {
        const hexColor = normalizeColorToHex(color);
        if (!hexColor) {
          return {
            content: [
              {
                type: 'text',
                text: `Invalid color: ${color}. Please use a hex code (e.g., "#ff0000") or an Apple crayon color name.`
              }
            ],
            isError: true
          };
        }
    
        routeToCurrentSession({
          type: 'changeColor',
          color: hexColor
        });
    
        const displayName = /^#[0-9A-Fa-f]{6}$/.test(color) ? hexColor : `${color} (${hexColor})`;
        return {
          content: [
            {
              type: 'text',
              text: `Model color changed to ${displayName}`
            }
          ]
        };
      }
    );
  • Handler function that validates/normalizes the color input using normalizeColorToHex, then routes a 'changeColor' command to the connected browser via WebSocket, and returns a text response.
    async ({ color }) => {
      const hexColor = normalizeColorToHex(color);
      if (!hexColor) {
        return {
          content: [
            {
              type: 'text',
              text: `Invalid color: ${color}. Please use a hex code (e.g., "#ff0000") or an Apple crayon color name.`
            }
          ],
          isError: true
        };
      }
    
      routeToCurrentSession({
        type: 'changeColor',
        color: hexColor
      });
    
      const displayName = /^#[0-9A-Fa-f]{6}$/.test(color) ? hexColor : `${color} (${hexColor})`;
      return {
        content: [
          {
            type: 'text',
            text: `Model color changed to ${displayName}`
          }
        ]
      };
    }
  • Helper function that normalizes color input - accepts hex codes (#rrggbb) or Apple crayon color names (case-insensitive, handles 'sea foam' variants) and returns the normalized hex color string.
    function normalizeColorToHex(colorInput) {
      if (!colorInput || typeof colorInput !== 'string') {
        return null;
      }
      
      // Check if it's already a hex code
      if (/^#[0-9A-Fa-f]{6}$/.test(colorInput)) {
        return colorInput.toLowerCase();
      }
      
      // Normalize the input: lowercase, trim, and handle variations
      let normalizedName = colorInput.toLowerCase().trim();
      
      // Handle "sea foam" variations (with space, without space, with hyphen)
      if (normalizedName === 'seafoam' || normalizedName === 'sea-foam') {
        normalizedName = 'sea foam';
      }
      
      // Try to find it as an Apple crayon color name
      const hexColor = appleCrayonColorsHexStrings.get(normalizedName);
      
      if (hexColor) {
        return hexColor.toLowerCase();
      }
      
      return null;
    }
  • Zod schema for color input validation - accepts hex codes (#rrggbb) or Apple crayon color names (case-insensitive). Used as the input schema for the change_model_color tool.
    const colorSchema = z.string().refine(
      (val) => {
        // Accept hex codes
        if (/^#[0-9A-Fa-f]{6}$/.test(val)) {
          return true;
        }
        // Accept Apple crayon color names (case-insensitive)
        let normalizedName = val.toLowerCase().trim();
        // Handle "sea foam" variations
        if (normalizedName === 'seafoam' || normalizedName === 'sea-foam') {
          normalizedName = 'sea foam';
        }
        return appleCrayonColorsHexStrings.has(normalizedName);
      },
      {
        message: `Must be a hex color code (e.g., "#ff0000") or an Apple crayon color name. Available colors: ${availableColorNames}`
      }
    ).describe(`Hex color code (e.g., "#ff0000") or Apple crayon color name (e.g., "maraschino", "turquoise", "lemon"). Available colors: ${availableColorNames}`);
  • Exports the Apple Crayon color palette map used by normalizeColorToHex and colorSchema to resolve color names to hex values.
    export {
        appleCrayonColorsHexStrings,
        colorComplements
    };
Behavior3/5

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

No annotations provided, so description carries full burden. It mentions 'change' implying mutation, but does not disclose side effects, reversibility, or whether it replaces or modifies the existing color. For a simple color change, it's adequate but minimal.

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?

One sentence that is direct and efficient. No unnecessary words. It is front-loaded with the action and object.

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

Completeness4/5

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

Given no output schema and no annotations, the description plus the rich parameter schema provide sufficient context for a simple setter. It does not explain return values or error conditions, but for this type of tool, that is acceptable.

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 single parameter 'color' is fully described in the input schema (100% coverage) with hex codes and Apple crayon names. The tool description adds no extra meaning beyond what the schema provides, so baseline score of 3 is appropriate.

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?

Description clearly states it changes the 3D model's color, a specific verb+resource. It distinguishes itself from sibling tools like change_background_color or set_model_rotation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or alternatives are given. However, since it's the only tool specifically for changing the model's color, usage is implied. Lack of exclusions or context about other potential color-changing tools like set_fill_light_color doesn't hinder clarity.

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/aidenlab/hello3dmcp-server'

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