Skip to main content
Glama

draw_gradient

Fills a rectangle with a linear gradient from evenly spaced color stops, supporting horizontal or vertical direction and dithering for pixel-art shading.

Instructions

Fill rect with a linear gradient through evenly spaced colour stops.

The first column (or row, for vertical) gets the first colour and the last one the last colour, measured over the whole rect even where it leaves the canvas; only the part on the canvas is painted and the rest is counted in skipped_outside. dither="none" mixes the two neighbouring stops per channel, alpha included, rounding halves up; indexed sprites then get the nearest palette entry for each mix. A bayer dither uses only the stop colours: each pixel takes the next stop when its position in the segment (0..1) is above the matrix threshold at its canvas position.

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>",
      "colors": "<colors>"
    },
    "name": "draw_gradient"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesSprite file. Relative paths resolve against the server root.
rectYesCanvas rectangle to paint
blendNofalse: pixels get exactly this colour (transparent erases, except on a background layer, which ignores alpha); true: the colour is alpha-blended over what is there
frameNo1-based frame number
layerNoLayer name or 'group/child' path; empty = the bottom-most normal layer
colorsYesGradient stops, evenly spaced
ditherNoOrdered dithering between stops; none gives hard bandsnone
directionNohorizontal runs left to righthorizontal
create_celNoAdd an empty cel when the layer has none in that frame

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the burden, and it discloses off-canvas clipping, skipped_outside counting, alpha-inclusive dither mixing/rounding, indexed-palette mapping, and bayer threshold behavior. It does not explicitly state that the sprite is mutated or how existing pixels are overwritten beyond what the schema's blend field already covers.

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

Conciseness5/5

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

The definition leads with the core action and then spends its remaining space on the gradient and dither rules that are hardest to infer. The technical detail is dense but relevant for a 9-parameter drawing tool, and there is no filler.

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

Completeness4/5

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

For a 9-parameter mutation tool with no annotations, the description covers the main visual algorithm and clipping behavior, while the rich input and output schemas already cover most field-level details. It could still be more explicit about write/overwrite side effects and error conditions, so it is not fully complete.

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?

Schema coverage is 100%, so the baseline is 3; the description goes beyond the schema by explaining that stops span the whole rect, including off-canvas portions, and by detailing how 'none' versus bayer dither resolves per pixel. It still leaves path, layer, frame, blend, and create_cel semantics to the schema.

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?

The opening sentence gives a specific action and resource: filling a rectangle with a linear gradient through evenly spaced colour stops. The gradient wording implicitly separates it from solid rectangle fills such as draw_rect and from pixel/line drawing siblings, so the operation is identifiable 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 Guidelines2/5

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

No sentence states when to choose this over draw_rect, draw_pixels, or another drawing sibling, nor when not to use it. The purpose makes the use case inferable, but the definition leaves alternatives and exclusions entirely to the agent.

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