Skip to main content
Glama

set_layer_position

Set the scale and offset of a layer or group within an icon bundle to zoom or reposition the glyph.

Instructions

Set the scale (zoom) and offset of a layer or group within the .icon bundle. Use to zoom the glyph in/out or reposition it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bundle_pathYesPath to .icon bundle
targetNoWhether to set position on a layer or grouplayer
group_indexNoGroup index (0-based)
layer_indexNoLayer index within the group (0-based, required for target=layer)
scaleNoScale factor (0.05-3.0, where 1.0 = full size, 0.5 = half, 2.0 = double)
offset_xNoX offset in points
offset_yNoY offset in points

Implementation Reference

  • The actual handler that reads an icon bundle manifest, updates the scale and offset (translation-in-points) for either a group or a specific layer, then saves the manifest.
    export async function setLayerPosition(params: SetLayerPositionParams): Promise<McpResult> {
      try {
        const { manifest } = await readIconBundle(params.bundle_path);
    
        if (manifest.groups.length === 0) {
          return err('Error: No groups in this icon bundle');
        }
    
        const group = manifest.groups[Math.min(params.group_index, manifest.groups.length - 1)];
    
        if (params.target === 'group') {
          const currentPos = group.position ?? { scale: 1.0, 'translation-in-points': [0, 0] as [number, number] };
          group.position = {
            scale: params.scale ?? currentPos.scale,
            'translation-in-points': [
              params.offset_x ?? currentPos['translation-in-points'][0],
              params.offset_y ?? currentPos['translation-in-points'][1],
            ],
          };
        } else {
          const layerIdx = params.layer_index ?? 0;
          if (layerIdx >= group.layers.length) {
            return err(`Error: Layer index ${layerIdx} out of range (group has ${group.layers.length} layers)`);
          }
          const layer = group.layers[layerIdx];
          const currentPos = layer.position ?? { scale: 1.0, 'translation-in-points': [0, 0] as [number, number] };
          layer.position = {
            scale: params.scale ?? currentPos.scale,
            'translation-in-points': [
              params.offset_x ?? currentPos['translation-in-points'][0],
              params.offset_y ?? currentPos['translation-in-points'][1],
            ],
          };
        }
    
        await saveManifest(params.bundle_path, manifest);
    
        const targetDesc = params.target === 'group'
          ? `group ${params.group_index}`
          : `layer ${params.layer_index ?? 0} in group ${params.group_index}`;
    
        return ok(`Updated position on ${targetDesc}: scale=${params.scale ?? '(unchanged)'}, offset=(${params.offset_x ?? '(unchanged)'}, ${params.offset_y ?? '(unchanged)'})`);
      } catch (error: unknown) {
        const msg = error instanceof Error ? error.message : 'Unknown error';
        return err(`Error: ${msg}`);
      }
    }
  • TypeScript interface defining the input parameters for set_layer_position.
    export interface SetLayerPositionParams {
      bundle_path: string;
      target: 'layer' | 'group';
      group_index: number;
      layer_index?: number;
      scale?: number;
      offset_x?: number;
      offset_y?: number;
    }
  • src/server.ts:207-221 (registration)
    Registers the tool with the MCP server using the name 'set_layer_position', defines Zod schema for input validation, and delegates to the handler function.
    // ── Tool: set_layer_position ──
    server.tool(
      'set_layer_position',
      'Set the scale (zoom) and offset of a layer or group within the .icon bundle. Use to zoom the glyph in/out or reposition it.',
      {
        bundle_path: z.string().describe('Path to .icon bundle'),
        target: z.enum(['layer', 'group']).default('layer').describe('Whether to set position on a layer or group'),
        group_index: z.number().default(0).describe('Group index (0-based)'),
        layer_index: z.optional(z.number()).describe('Layer index within the group (0-based, required for target=layer)'),
        scale: z.optional(z.number().min(0.05).max(3.0)).describe('Scale factor (0.05-3.0, where 1.0 = full size, 0.5 = half, 2.0 = double)'),
        offset_x: z.optional(z.number()).describe('X offset in points'),
        offset_y: z.optional(z.number()).describe('Y offset in points'),
      },
      async (params) => setLayerPosition(params),
    );
Behavior2/5

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

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only states that the tool sets values, but does not describe side effects (e.g., overwriting vs merging), required permissions, error conditions, or return value. For a mutation tool with no output schema, this is a significant gap.

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 two sentences, no fluff. First sentence defines the action and scope; second sentence suggests usage. Information is front-loaded and every word adds value. Excessively concise without missing critical 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?

Given 7 parameters, the description covers the core purpose but lacks details on preconditions (e.g., bundle_path must exist), validation (how group/layer indices are used), and return behavior. Schema covers parameter meanings, but overall behavioral completeness is moderate.

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 schema already documents each parameter. The description adds minimal extra meaning beyond restating that scale and offset are involved. It does not clarify relationships between parameters (e.g., what happens if target is 'group' but layer_index is provided). Baseline 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?

The description clearly states the verb 'Set' and the resource 'scale and offset of a layer or group', and specifies the scope 'within the .icon bundle'. It distinguishes from sibling tools like set_fill or set_glass_effects by focusing on position/zoom. The use case 'zoom the glyph in/out or reposition it' reinforces purpose.

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

Usage Guidelines4/5

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

The description explicitly says 'Use to zoom the glyph in/out or reposition it', indicating when to use the tool. It does not explicitly list alternatives or when not to use, but the sibling tools cover other aspects (e.g., set_fill for color, set_appearances for styling), so usage context is implied.

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