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
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project identifier | |
| frameIndex | Yes | Index of the frame to duplicate |
Implementation Reference
- src/server/PiskelServer.ts:1024-1047 (handler)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, }; } - src/server/PiskelServer.ts:220-220 (registration)The `duplicate_frame` tool is registered in the MCP server definition within `PiskelServer.ts`.
name: 'duplicate_frame',