Skip to main content
Glama

draw_pixel_map

Paint pixel art from a character grid with a color legend, enabling precise per-pixel edits without long coordinate lists.

Instructions

Draw from a character grid, one character per pixel: the way pixel art is authored.

This is the write side of get_pixels(format="map") and takes exactly the shape that returns, a legend plus one string per row, so a read, an edit and a write round-trip. Until this existed the server could show a caller per-pixel intent and could not receive it: the only way to author a figure was a list of {"x", "y", "color"} dictionaries, one per pixel.

That asymmetry shaped the art it produced, which is the real reason this is here. A caller reaching for a thousand-entry dictionary list does not write a thousand considered pixels, it writes a formula that emits them, and a formula produces smooth monotone surfaces. Hand-placed pixel art is the opposite of that: a highlight nudged two pixels off the geometric centre, an outline that thickens on the shadow side, three pixels clustered to imply a chip in the stone. A grid is the notation those decisions can be written in, and it is about a tenth the size: a 16x16 of three colours is roughly 3,400 characters as dictionaries and 350 as a map.

Args: rows: One string per row, one character per pixel, every row the same length. A ragged map is refused rather than padded, because padding would shift every pixel after the short row. legend: Symbol to colour, as {"a": "#1b2b4a", "b": "red"}. "." means leave that pixel alone and needs no entry; any other character can say the same with the value "transparent", which is what the read side emits. A character the legend does not define is refused, not skipped: a typo in a grid would otherwise paint nothing and report success. x, y: Where the map's top-left corner lands on the canvas. Defaults to the canvas origin. layer: Target layer name or 1-based index (default: top layer). frame: Target frame, 1-based (default 1).

Transparent cells are left untouched rather than erased, so a map can be stamped over existing art; clear the layer first if you want the map to be the whole of it.

Returns the usual write counters plus map_width, map_height, pixels_transparent (cells deliberately left alone) and colors_used.

Coordinates: (0, 0) is the top-left pixel. x grows right, y grows DOWN. A span given as position plus size covers x .. x + width - 1, so width is a count of pixels, not an offset to the far edge.

Centring differs between primitives, so check this when aligning two shapes:

  • draw_rectangle(x, width) spans x .. x+width-1, centred on x + (width-1)/2. An even width therefore centres on a half pixel.

  • draw_ellipse(center, radius) spans center-radius .. center+radius, which is always an ODD 2*radius+1 pixels wide and always centred on a whole pixel.

  • draw_ellipse_in_box(x, y, width, height) takes the same bounding box as draw_rectangle and fills it exactly, so it is the one to use for an even diameter, a disc centred on an even canvas, or a circle that has to line up with a rectangle.

  • draw_symmetric_pixels mirrors about the canvas, not about either of the above.

Writes falling outside the canvas are dropped rather than raising. Every drawing tool reports pixels_written, and pixels_clipped when anything was dropped, so compare those against what you asked for rather than trusting ok.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xNoDefault: 0.
yNoDefault: 0.
rowsYes
frameNoDefault: 1.
layerNo
legendYes
filenameYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.10.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only declare `readOnlyHint=false` and `openWorldHint=false`; the description adds substantial behavioral detail beyond that: ragged maps are refused rather than padded, undefined legend characters are refused rather than skipped, transparent cells are left untouched so maps can be stamped over existing art, and out-of-bounds writes are dropped with `pixels_clipped` reported. This is rich disclosure of failure modes and side effects.

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

Conciseness3/5

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

The description is well-structured with clear sections for args, returns, coordinates, and centering, but it is long and includes extended rationale about the asymmetry of prior APIs and the nature of hand-placed pixel art. Some of that narrative is justification rather than actionable guidance, so it is not as concise as it could be.

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?

There is no output schema, but the description explains the returned counters (`map_width`, `map_height`, `pixels_transparent`, `colors_used`) and the general write counters, along with clipping behavior, coordinate conventions, and centering differences among related primitives. For a complex 7-parameter write tool with minimal annotations, this is complete enough to invoke correctly, with only the trivial omission of `filename`.

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

Parameters4/5

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

With only 43% schema description coverage, the description carries most parameter meaning: it explains `rows` (one string per row, equal lengths, ragged refused), `legend` (symbol-to-color mapping, `.` and `transparent` semantics, undefined characters refused), `x`/`y` (top-left placement), `layer` (name or 1-based index, default top), and `frame` (1-based, default 1). It does not mention the required `filename` parameter, leaving a small gap.

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?

States a specific verb and resource ('Draw from a character grid, one character per pixel') and explicitly positions itself as the write side of `get_pixels(format="map")`, distinguishing it from dictionary-list pixel writing and from sibling drawing tools. An agent can identify exactly what it 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?

Provides clear context: it round-trips with `get_pixels(format="map")` and is the notation for hand-placed pixel art, contrasted with formula-generated dictionary lists. However, it does not explicitly state when to choose this over `draw_pixels`, `draw_line`, or other drawing primitives, nor does it give exclusions.

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

Deploy Server

Other Tools