Skip to main content
Glama

Change Background Color

change_background_color

Modify the background color of a 3D scene by specifying a hex color code or color name to alter the visual environment.

Instructions

Change the background color of the 3D 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

  • Complete tool registration and handler for change_background_color. Validates the color input using normalizeColorToHex, routes the command to the current session via WebSocket, and returns a success message with the display name of the color.
    // Register tool: change_background_color
    mcpServer.registerTool(
      'change_background_color',
      {
        title: 'Change Background Color',
        description: 'Change the background color of the 3D 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., "#000000") or an Apple crayon color name.`
              }
            ],
            isError: true
          };
        }
    
        routeToCurrentSession({
          type: 'changeBackgroundColor',
          color: hexColor
        });
    
        const displayName = /^#[0-9A-Fa-f]{6}$/.test(color) ? hexColor : `${color} (${hexColor})`;
        return {
          content: [
            {
              type: 'text',
              text: `Background color changed to ${displayName}`
            }
          ]
        };
      }
    );
  • Zod schema for color input validation. Accepts hex color codes (e.g., '#ff0000') or Apple crayon color names (e.g., 'maraschino'). Used by change_background_color and other color tools.
    // Zod schema for color input - accepts hex codes or Apple crayon color names
    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}`);
  • Helper function normalizeColorToHex that converts color input (hex code or Apple crayon color name) to a normalized hex color code. Returns null if invalid. Used by change_background_color handler.
    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;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Change' implies a mutation operation, the description doesn't specify whether this requires specific permissions, whether the change is persistent, what happens to existing settings, or what visual feedback to expect. For a mutation tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 that states exactly what the tool does with zero wasted words. It's appropriately sized for a simple tool with one parameter and gets straight to the point.

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 mutation tool with no annotations and no output schema, the description is minimally adequate. It states what the tool does but doesn't provide important context about the mutation's effects, persistence, or visual feedback. Given the tool's simplicity (one parameter, 100% schema coverage), the description meets basic requirements but could better address the mutation implications.

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 schema description coverage is 100%, with the parameter 'color' fully documented in the schema including format examples and available color options. The description adds no additional parameter information beyond what's already in the schema, which is acceptable given the comprehensive schema coverage.

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 ('Change') and target ('background color of the 3D scene'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'change_model_color' or 'set_fill_light_color', which perform similar color changes on different scene elements.

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 many sibling tools that modify colors of different scene elements (model, fill light, key light), there's no indication of when background color changes are appropriate versus other color modifications.

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