Skip to main content
Glama

set_fill

Set the background fill of an Apple .icon bundle using solid colors or gradients. Supports hex colors and gradient angle control.

Instructions

Set the background fill of an .icon bundle. Supports solid colors and gradients.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bundle_pathYesPath to .icon bundle
fill_typeYesFill type
colorNoHex color for solid fill or gradient bottom
color2NoSecond hex color for gradient top
gradient_angleNoGradient angle in degrees (0 = bottom to top)

Implementation Reference

  • The `setFill` function — the core handler that reads the icon bundle manifest, sets the background fill based on `fill_type` (none, automatic, solid, or gradient), computes gradient orientation from `gradient_angle`, and saves the updated manifest.
    export async function setFill(params: SetFillParams): Promise<McpResult> {
      try {
        const { manifest } = await readIconBundle(params.bundle_path);
    
        if (params.fill_type === 'none') {
          manifest.fill = 'none';
        } else if (params.fill_type === 'automatic') {
          manifest.fill = 'automatic';
        } else if (params.fill_type === 'solid' && params.color) {
          manifest.fill = solidFill(params.color);
        } else if (params.fill_type === 'gradient' && params.color && params.color2) {
          const angle = (params.gradient_angle * Math.PI) / 180;
          manifest.fill = {
            'linear-gradient': [
              hexToIconColor(params.color),
              hexToIconColor(params.color2),
            ],
            orientation: {
              start: {
                x: 0.5 - Math.sin(angle) * 0.5,
                y: 0.5 + Math.cos(angle) * 0.5,
              },
              stop: {
                x: 0.5 + Math.sin(angle) * 0.5,
                y: 0.5 - Math.cos(angle) * 0.5,
              },
            },
          };
        }
    
        await saveManifest(params.bundle_path, manifest);
    
        return ok(`Updated fill in ${params.bundle_path}`);
      } catch (error: unknown) {
        const msg = error instanceof Error ? error.message : 'Unknown error';
        return err(`Error: ${msg}`);
      }
    }
  • The `SetFillParams` interface defining input parameters: bundle_path, fill_type (solid|gradient|automatic|none), color, color2, and gradient_angle.
    export interface SetFillParams {
      bundle_path: string;
      fill_type: 'solid' | 'gradient' | 'automatic' | 'none';
      color?: string;
      color2?: string;
      gradient_angle: number;
    }
  • src/server.ts:193-205 (registration)
    The MCP tool registration for 'set_fill' on the server, with Zod schema for validation (bundle_path, fill_type enum, optional color/color2, gradient_angle with default 0), delegating to the `setFill` handler.
    // ── Tool: set_fill ──
    server.tool(
      'set_fill',
      'Set the background fill of an .icon bundle. Supports solid colors and gradients.',
      {
        bundle_path: z.string().describe('Path to .icon bundle'),
        fill_type: z.enum(['solid', 'gradient', 'automatic', 'none']).describe('Fill type'),
        color: z.optional(z.string()).describe('Hex color for solid fill or gradient bottom'),
        color2: z.optional(z.string()).describe('Second hex color for gradient top'),
        gradient_angle: z.number().default(0).describe('Gradient angle in degrees (0 = bottom to top)'),
      },
      async (params) => setFill(params),
    );
  • The `solidFill` helper function that converts a hex color string to the `{ solid: colorString }` format used by the manifest.
    export function solidFill(hex: string): FillValue {
      return { solid: hexToIconColor(hex) };
    }
  • The `hexToIconColor` helper function that converts a hex color (e.g., #FF6B35) to the icon color string format (e.g., 'srgb:1.00000,0.41961,0.20784,1.00000'), used by both solid and gradient fills.
    export function hexToIconColor(hex: string, colorSpace: string = 'srgb'): string {
      hex = hex.replace('#', '');
      if (hex.length === 3) {
        hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
      }
      if ((hex.length !== 6) || !/^[0-9a-fA-F]{6}$/.test(hex)) {
        return `${colorSpace}:0.00000,0.00000,0.00000,1.00000`;
      }
      const r = parseInt(hex.slice(0, 2), 16) / 255;
      const g = parseInt(hex.slice(2, 4), 16) / 255;
      const b = parseInt(hex.slice(4, 6), 16) / 255;
      return `${colorSpace}:${r.toFixed(5)},${g.toFixed(5)},${b.toFixed(5)},1.00000`;
    }
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It indicates mutation ('Set') but does not mention side effects, permissions, or data persistence. The brief description offers minimal behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no extraneous information. However, it could be slightly expanded to include usage or behavioral context without losing conciseness.

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 five parameters, no output schema, and no annotations, the description is too thin. It fails to explain return values, constraints, or what happens after setting fill, leaving the agent with insufficient 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 baseline is 3. The description adds no extra meaning beyond the schema parameter descriptions (e.g., doesn't explain 'automatic' or 'none' fill types). It remains generic.

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 action ('Set the background fill'), the target resource ('.icon bundle'), and the value it supports ('solid colors and gradients'), making it easily distinguishable from sibling tools like add_layer_to_icon or set_appearances.

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?

The description implies usage for setting background fill with solid or gradient colors, but lacks explicit guidance on when to use this tool versus alternatives (e.g., set_appearances) or when not to use it. No exclusions or prerequisites are mentioned.

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/ethbak/icon-composer-mcp'

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