Skip to main content
Glama

duplicate_frame

Create a copy of an existing animation frame in pixel art projects to reuse or modify content without redrawing.

Instructions

Duplicate a frame

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject identifier
frameIndexYesIndex of the frame to duplicate

Implementation Reference

  • The `duplicateFrame` method in `PiskelServer` implements the logic for the `duplicate_frame` MCP tool by duplicating the frame in all layers of the project and returning information about the new frame.
    private duplicateFrame(projectId: string, frameIndex: number): object {
      const piskel = this.getProject(projectId);
    
      if (frameIndex < 0 || frameIndex >= piskel.getFrameCount()) {
        throw new Error(`Frame index ${frameIndex} out of range`);
      }
    
      // Duplicate frame in all layers
      for (let i = 0; i < piskel.getLayerCount(); i++) {
        const layer = piskel.getLayerAt(i);
        if (layer) {
          const frame = layer.getFrameAt(frameIndex);
          if (frame) {
            layer.addFrame(frame.clone());
          }
        }
      }
    
      return {
        success: true,
        sourceFrameIndex: frameIndex,
        newFrameIndex: piskel.getFrameCount() - 1,
      };
    }
  • The `duplicate_frame` tool is registered in the MCP server definition within `PiskelServer.ts`.
    name: 'duplicate_frame',

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/yafeiaa/piskel-mcp-server'

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