Skip to main content
Glama

get_pixel

Retrieve the color value of a specific pixel from a pixel art project by specifying coordinates, project ID, and optional layer and frame indices.

Instructions

Get the color of a pixel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject identifier
layerIndexNoLayer index (default: 0)
frameIndexNoFrame index (default: 0)
xYesX coordinate
yYesY coordinate

Implementation Reference

  • The handler function for the get_pixel tool. It retrieves the frame and calls its getPixel method, then formats the result.
    private getPixelTool(
      projectId: string,
      layerIndex: number,
      frameIndex: number,
      x: number,
      y: number
    ): object {
      const frame = this.getFrame(projectId, layerIndex, frameIndex);
      const color = frame.getPixel(x, y);
    
      if (color === null) {
        return {
          x,
          y,
          color: 'out_of_bounds',
          colorInt: null,
        };
      }
    
      return {
        x,
        y,
        color: color === 0 ? 'transparent' : intToHex(color),
        colorInt: color,
      };
    }
    
    private getFrameDataTool(
  • The schema definition for the get_pixel tool registration.
    {
      name: 'get_pixel',
      description: 'Get the color of a 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)',
          },
          x: {
  • The low-level helper function on the Frame class that retrieves the pixel value from the underlying pixel array.
    getPixel(x: number, y: number): number | null {
      if (!this.containsPixel(x, y)) {
        return null;
      }
      return this.pixels[y * this.width + x];
    }

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