Skip to main content
Glama

draw_pixels

Draw multiple pixels simultaneously in pixel art projects to create shapes, patterns, or fill areas efficiently using specified coordinates and colors.

Instructions

Draw multiple pixels at once

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject identifier
layerIndexNoLayer index (default: 0)
frameIndexNoFrame index (default: 0)
pixelsYesArray of pixel coordinates
colorYesColor in hex format

Implementation Reference

  • The server-side handler for the 'draw_pixels' tool, which fetches the correct frame and calls the core `drawPixels` function.
    private drawPixelsTool(
      projectId: string,
      layerIndex: number,
      frameIndex: number,
      pixels: Array<{ x: number; y: number }>,
      color: string
    ): object {
      const frame = this.getFrame(projectId, layerIndex, frameIndex);
      const count = drawPixels(frame, pixels, color);
      return { success: true, pixelsDrawn: count };
    }
  • The core logic for drawing pixels on a frame.
    export function drawPixels(
      frame: Frame,
      pixels: Array<{ x: number; y: number }>,
      color: number | string
    ): number {
      let count = 0;
      const colorInt = typeof color === 'string' ? colorToInt(color) : color;
    
      for (const { x, y } of pixels) {
        if (frame.containsPixel(x, y)) {
          frame.setPixel(x, y, colorInt);
          count++;
        }
      }
    
      return count;
    }
  • Registration of the 'draw_pixels' tool within the server's tool definitions.
    name: 'draw_pixels',
    description: 'Draw multiple pixels at once',
    inputSchema: {
      type: 'object',
      properties: {
        projectId: {
          type: 'string',
          description: 'Project identifier',
        },
        layerIndex: {
          type: 'number',
          description: 'Layer index (default: 0)',
        },
        frameIndex: {
          type: 'number',
          description: 'Frame index (default: 0)',
        },
        pixels: {
          type: 'array',
          items: {
            type: 'object',
            properties: {

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