Skip to main content
Glama

add_layer

Add a new layer to a pixel art project for organizing elements, enabling separate editing of components like foreground, background, or animation frames.

Instructions

Add a new layer to the project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject identifier
layerNameNoName for the new layer

Implementation Reference

  • Implementation of the 'add_layer' tool handler.
    private addLayer(projectId: string, layerName?: string): object {
      const piskel = this.getProject(projectId);
      const name = layerName ?? `Layer ${piskel.getLayerCount()}`;
      const layer = new Layer(name);
    
      // Add frames to match existing frame count
      const frameCount = piskel.getFrameCount();
      for (let i = 0; i < frameCount; i++) {
        layer.addFrame(new Frame(piskel.getWidth(), piskel.getHeight()));
      }
    
      piskel.addLayer(layer);
    
      return {
        success: true,
        layerIndex: piskel.getLayerCount() - 1,
        layerName: name,
      };
    }
  • Registration of the 'add_layer' tool in the Piskel MCP Server.
    {
      name: 'add_layer',
      description: 'Add a new layer to the project',
      inputSchema: {
        type: 'object',
        properties: {
          projectId: {
            type: 'string',
            description: 'Project identifier',
          },
          layerName: {
            type: 'string',
            description: 'Name for the new layer',
          },
        },
        required: ['projectId'],
      },
    },

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