draw_pixel
Draw a single pixel at specified coordinates with a chosen color in pixel art projects. Use this tool to place individual pixels for detailed editing, corrections, or precise artwork creation within animation frames and layers.
Instructions
Draw a single pixel
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project identifier | |
| layerIndex | No | Layer index (default: 0) | |
| frameIndex | No | Frame index (default: 0) | |
| x | Yes | X coordinate | |
| y | Yes | Y coordinate | |
| color | Yes | Color in hex format (e.g., "#FF0000" or "rgba(255,0,0,1)") |
Implementation Reference
- src/server/PiskelServer.ts:1050-1061 (handler)The PiskelServer method that acts as the handler for the 'draw_pixel' MCP tool, executing the core drawing logic.
private drawPixelTool( projectId: string, layerIndex: number, frameIndex: number, x: number, y: number, color: string ): object { const frame = this.getFrame(projectId, layerIndex, frameIndex); const success = drawPixel(frame, x, y, color); return { success, x, y, color }; } - src/tools/drawing.ts:24-35 (handler)The core drawing function that implements the pixel-setting logic, which is called by the handler.
export function drawPixel( frame: Frame, x: number, y: number, color: number | string ): boolean { if (!frame.containsPixel(x, y)) { return false; } frame.setPixel(x, y, color); return true; } - src/server/PiskelServer.ts:239-255 (registration)The registration of the 'draw_pixel' tool in the PiskelServer, defining its name, description, and input schema.
{ name: 'draw_pixel', description: 'Draw a single pixel', 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)',