Skip to main content
Glama

read_pixels

Read-only

Extracts pixel colors from a sprite rectangle as rows, hex, or JSON; choose composited visible layers or a specific layer's own pixels.

Instructions

Read the pixels in rect; parts outside the canvas read as transparent.

rows: one character per pixel with a legend of character -> colour, '.' for transparent; x, y, rows and legend can be passed to draw_ascii as they are when the rect is at most 256 pixels wide and tall and the legend has 1 to 256 keys (draw_ascii refuses an empty legend, so an all-transparent read cannot go back). hex: rows of space-separated '#rrggbb'/'#rrggbbaa', '.' for transparent. json: pixels as a list of rows of colours or 'transparent'. Without layer, the visible layers are composited (layer opacity and blend modes applied, hidden layers and groups left out). With layer, that layer's own pixels are read, even when it is hidden, without its opacity. Indexed and grayscale sprites give their RGBA colours. At most ASEPRITE_MCP_MAX_READ_PIXELS pixels (default 65536) per call; use view_sprite to look at larger areas.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>",
      "rect": "<rect>"
    },
    "name": "read_pixels"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesSprite file. Relative paths resolve against the server root.
rectYesCanvas rectangle to read
frameNo1-based frame number
layerNoLayer name or 'group/child' path for that layer's own pixels; omit for the visible layers composited
formatNoShape of the returned pixelsrows

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond readOnlyHint=true, it discloses compositing rules (layer opacity and blend modes applied, hidden layers and groups excluded), that the layer form reads hidden layers at full opacity, that indexed/grayscale sprites are returned as RGBA, and a hard quota (ASEPRITE_MCP_MAX_READ_PIXELS, default 65536). It also flags a real trap: draw_ascii refuses an empty legend, so an all-transparent read cannot round-trip.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action and kept dense; each sentence covers a distinct concern (formats, layer semantics, limits). The per-format lines are tersely written and take a moment to parse, but nothing is padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers the composite-vs-single-layer distinction, format outputs, pixel-count limit with the sibling escape hatch, and out-of-canvas behaviour. With an output schema present and 100% parameter coverage, no gap remains that would cause a mis-call.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds substantial meaning: for each 'format' enum value it specifies the actual output shape (character rows plus legend, space-separated #rrggbb/#rrggbbaa, JSON colour rows) and it refines 'layer' beyond the schema by stating hidden layers are still read and opacity is not applied.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource and scope ('Read the pixels in rect; parts outside the canvas read as transparent'), then distinguishes itself from siblings by naming view_sprite for larger areas and draw_ascii as a downstream consumer. An agent can tell exactly what this does without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear alternative with its trigger condition ('use view_sprite to look at larger areas') and explains when to supply vs omit 'layer'. It does not address other plausible alternatives (e.g. find_stray_pixels for inspection sweeps), so it stops short of full when/when-not coverage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.