Paint
canvas_drawPaint on a canvas, using its explicit ID when possible: a list of ops (up to 400 per call, 240 kB), drawn in order. Everyone watching sees them drawn in, stroke by stroke. note: a short caption of what this stage is. canvas_schema {op} gives one kind's fields and an example; mode validate to rehearse and mode atomic to apply all or none. Ops that don't make sense are skipped and listed back, and so are keys that did nothing. Results have bounds as painted (text as set); warning_groups has warnings that never block: past_edge, off_canvas, text_overlap, text_overflows (words wider or taller than the box they sit in: a label out of its pill; a text's fit {w} keeps it in), low_contrast (text a shape drawn above wholly covers, a page behind a dimmed backdrop, is not judged), kit_color (a literal color equal to a kit color: write the role it names), second_accent (a second saturated hue on a large area that is not a brand role), short_card (a card whose content fills under about 60% of it), body_too_small (body text under 14 px on a desktop artboard, 15 on a phone) (validate gives them too, saving nothing). Look at the result with canvas_look. Longer guides are in canvas_schema {topic}: "style" (how to make a piece that is yours; read it before a new piece), "paint" (colors, gradients, brushes), "motion", "layout" and "brand".
A design is an open surface, -20000..20000 each way; nothing is cut off. Artboards (canvas_edit frames) are its sized parts, the files; canvas_open lists them. Origin top-left, y grows DOWN. Later ops paint over earlier ones.
Each op is {k, ...}:
path {d, fill?, stroke?, width?, dash?}: any SVG path data (M L C Q A Z...). Shapes, silhouettes, lettering, anything. Anywhere path data goes, a shape may instead be {curve: [[x,y], ...]} (smooth), {line: [...]}, mirrored with mirror {x: X}, or {spine: [[x,y], ...], width} (a body, ribbon or tail as one shape); canvas_schema {op: "path"} has them in full. Say a shape once: canvas_draw defs {fin: shape, body: shape} at the top of the call, then "$fin" anywhere path data goes in that call (d, clip, erase, text path, inside groups and repeats); a name not in defs fails that op alone. clip, erase and d also take {ref: "name" or "group/part"} (erase {ref, strength}): the outline of a shape already drawn, its at applied (in edits too), so a fin clips to its body.
stroke {points: [[x,y] or [x,y,pressure 0..1], ...], brush, color, width}: a hand-drawn line through them. Brushes: pen, ink, brush, dry, marker, pencil, chalk, spray, glow, sketch. ink and brush taper; sketch: a broken pen line (sketch {gaps, vary, taper}; width is typical); pressure: thick-thin lines. brush on a shape inks its outline (text: its edge). Or d (path data), with pressure [start, (middle,) end]; straight d keeps its corners.
circle {cx, cy, r} · ellipse {cx, cy, rx, ry, rot?} · rect {x, y, w, h, r?, rot?} · polygon {points} · line {x1, y1, x2, y2}: each with fill and/or stroke + width.
text {x, y, text, size, font, weight, italic?, spacing?, align start|middle|end, fill, wrap?, lineHeight?, fit?}: y is the first line's baseline. fonts: sans, ui, code, serif, mono, hand, marker, display, poster, heavy, hangul, dots, slam, grotesk, or an uploaded font's id. spacing in ems; starts a line; wrap: a width to break at; fit {w, by: shrink|ellipsis}: one line kept inside a width; path: one line along a curve. canvas_schema {op: "text"}: faces, weights, scripts.
scatter {shape, n (≤800), area, size: [min, max] across, colors, alpha: [min, max], rot: [min, max], seed}: small shapes at random: stars, snow. shapes: circle, dot, square, triangle, star, leaf, petal, line, heart. area is {x, y, w, h} or {cx, cy, r}.
flow {n (≤400), steps, len, scale, curl, angle, area, colors, width: [min, max], alpha, taper?, fade? in|out|both, seed}: lines following a smooth flow field: wind, water, hair, fur, wood grain, generative line work. scale 0.001 broad .. 0.01 busy; curl 0 straight .. 1 full swirls; angle 0 = right, 90 = down.
dabs {n, area or d, shape, size, colors, ...}: painted marks laid by a flow field, like a loaded brush (pointillism, brushwork skies); colors may be a gradient. canvas_schema {op: "dabs"}.
hatch {d (the shape), angle (or a list of up to 4), cross?, gap, width, color, tone?, wobble 0..1}: lines across a shape, cut at its edge, for engraving, etching and pen-and-ink. tone {linear|radial, stops: [[0, 1], [1, 0.1]]} is how dense the lines are (1 all, 0 none) across it: shade a form with it.
halftone {d (the shape), gap, dot 0.05..0.75, angle, color, tone?, screen?, slip? 0..1, origin? [x, y]}: print dots on a grid at angle, gap apart, cut at the shape: comic and screen-print shading. dot: a full dot's radius over gap; tone {linear|radial, stops} sizes the dots (1 full, 0 none). screen "page": the grid stays fixed to the canvas under at, use, repeat. slip: dots change in motion. origin: a dot sits there.
repeat {op (drawn about 0, 0), grid | ring | spiral | path, turn?, scale, rot, alpha, colors, jitter, seed}: copies of one op, up to 600: patterns, mandalas, borders. canvas_schema {op: "repeat"}.
tiles {d or area, shape (square, brick, hex, triangle, diamond), size, colors, gap, grout, jitter, seed}: a shape filled with packed tiles: mosaics, brick, honeycomb, stained glass. canvas_schema {op: "tiles"}.
pixels {x, y, cell, palette, rows, cellShape square|circle|diamond, gap 0..0.9}: a grid of color, row by row. palette is a list (keys 0-9, a-z, A-Z in order) or {key: color} with any single characters as keys; rows are strings of keys, "." empty. Pixel art, sprites, mosaics; circle cells with a gap make halftone or LED looks. Up to 256×256.
lsystem {axiom, rules, n, angle, len or fit, x, y, ...}: a turtle drawing of a rewritten string: trees, ferns, snowflakes, Koch curves. canvas_schema {op: "lsystem"}.
merge {mode unite|subtract|intersect|exclude, of [2-20 names or keys], keep, fill, stroke, width, opacity, name, layer}: shape merging. Works out ONE clean path from rect, circle, ellipse, polygon or closed-path objects already on the canvas (their at applied) and, unless keep is true, removes them in the same call. subtract is the first minus the rest. For logos, cut-outs, crescents, badges: {k: "merge", mode: "subtract", of: ["moon", "bite"], name: "crescent"}.
outline {of: [1-20 names or keys], keep, fill, opacity, name, layer}: turns text into its letter shapes (exactly as drawn, in its face) and a stroke, line or a shape's stroke into a filled shape, so it can be merged, warped, edited point by point or exported without fonts. One path per object (a group for several); removes the originals unless keep is true. Not for spray, glow or dashed strokes.
image {src (https or data: URL, never SVG), x, y, w, h, fit}: places a picture your user gave you or you may use (limits in canvas_schema {op: "image"}); reuse it with {k: "image", img: ""}.
warp {of: [1-40 names or keys], to: [[x, y] top-left, top-right, bottom-right, bottom-left], keep, name, layer}: perspective. Maps the objects' shared box onto those four corners (a sign on a wall, a floor); each becomes a path (text and strokes outlined first), grouped under name. The corners must not cross. Like merge, it uses objects drawn in an earlier call.
Every op may add: opacity 0..1, blend (multiply, screen, overlay, darken, lighten, ...), blur (px), rough 0..1 (wobbly painted edges), wash 0..1 (a filled shape as watercolor), grain 0..1 (paper/chalk texture), boil (px: hand-drawn line wobble, 0.5-1, usually 0.75; text too), glow (px of soft halo) (rough, wash, grain, boil and glow are for artwork, not interface parts), shadow (true, {dx, dy, blur, color, opacity}, or an elevation's name, "raised" or "overlay": the kit's shadow by that name, so a brand restyles every raised card), clip (SVG path data: the op shows only inside it), erase (a closed SVG path that cuts through this op, or {d, strength} to lift some paint), mask {linear | radial, stops: [[0, 1], [1, 0]]} (fades it out, 1 shown, 0 hidden). anim makes it move (below). Objects, layers and edits, by name:
name an op ("name": "sun") to change or reuse it later. Every op also has a key "b.i" (draw call b, op i), which canvas_list and canvas_pick show.
layer: "sky", "far", "figure"... Layers stack in the order they first appear (canvas_edit reorders them); ops without one go on "paint", people's strokes on "people". A hidden layer is a good shelf for things you only copy with use.
at {x, y, scale, sx, sy, rot, skx, sky (slant, degrees), flip "x"|"y"|"xy", origin [x, y]}: moves, scales, turns, slants or flips any op about origin (default 0, 0), with all inside it (gradients, mask, clip, hatch, dab colors); a group's or use's at carries its children too. minWidth, minGap (op, group or use): lines and halftone gaps never draw under this many canvas px at any at scale.
part {part, x, y, scale?, rot?, flip?}: a detailed ready-made object from the public shelf (oak, pine, birch, bush, gull, songbird, cumulus, wisp, figure, walker, ui-button, ui-tag, ui-sidebar, ui-topbar, ui-table, ui-stat, ui-stepper, ui-field, ui-empty, ui-card, ui-row, ui-chart), linked to a master so one edit changes every one; the ui- ones (a sidebar, top bar, table, stat tile, stepper, field, empty state, status tag) are placed on a screen, not drawn, and filled with set; at the top level of a call (inside a group, use {ref: "part-"}). canvas_schema {op: "part"}.
icon {icon, x, y, size?, color?}: one of 1539 line icons by name (lucide.dev's: "search", "bell", "users"), in a color or brand role.
group {ops: [...]}: several ops as one object; its parts may have names (each once in the group), and canvas_edit and canvas_get reach a part by path, "balloon/flag" or "balloon/c3". use {ref, at}: a copy of a named object or group, or of a part by path ("girl/body") (edit the original and every copy follows). A use can map source colors to replacements with palette (or a named part's alone: {jacket: {color: color}}), and give its own values for the kit colors and fonts its source uses with kit {colors: {brand: "#e76f51"}, fonts: {heading: "poster"}} (that instance only). Its at is applied after the source's own at; place {x, y, scale?, rot?, flip?} instead puts the copy's centre on x, y and turns and scales it about there, whatever the source's at (a source drawn in an earlier call). canvas_edit {target, detach: true} turns a use into its own copy.
canvas_edit changes what is there without repainting: set properties, move, order, delete, a layer's opacity, blend, hidden, locked; and the background (frame).
fill and stroke take a color (#rrggbb, #rrggbbaa, rgb(), hsl(), names) or a gradient: {linear: [x1, y1, x2, y2], stops: [[0, "#1e3a8a"], [1, "#f59e0b"]]} or {radial: [cx, cy, r], stops: [...]} (in the op's own coordinates, as its shape; a stop may add a third value, its opacity). A radial gradient is a circle: on an ellipse or a long shape it reaches its last stop only at r, so to fade out before the edge make r the shorter half-size, or paint a circle and stretch it with at sx/sy. Brand kit, reference picture, frames: a canvas can carry named colors and fonts ("var(--brand)" anywhere a color goes, one kit edit restyles everything), a locked picture to paint against, and named frames exported as files of their own. canvas_schema {topic: "brand"} has them in full. Animation: anim on any op moves it: anim "float" (presets draw-on, fade-in, rise-in, pop-in, float, pulse, spin, sway, blink, hop, take, nod, shake, breathe, bounce, droop, shiver) or {keys: [{at: 0, dy: 0}, {at: 1, dy: -20}], dur: 2, delay, phase, repeat: "loop"}. dur is at most 60 s. phase 0..1 starts a loop part way through its round. canvas_look strip: true checks it (span [from, to] for a short loop). canvas_schema {topic: "motion"} has it in full. Stacks: group {layout: {dir: "row"|"col", gap, pad, align, justify, w}, ops} places its parts like a web page; canvas_schema {topic: "layout"}. Style: {k: "starter", style: interface|etching|watercolor|poster|pixel|logo} sets up a style's ground and layers; interface is the start for a product screen, page or dashboard (restrained type, lines and one accent). canvas_schema {topic: "style"}: read it before a new piece. Feedback: people pin comments to spots, sometimes with a sketch: direction for you, not part of the painting. canvas_open lists them; change the painting, look, then answer each with canvas_feedback (done: true when it's made). Work in stages of about 8-12 ops, one call each, with a short note (shown as a caption) and next. Look after each stage (preview "after" or canvas_look) and fix with canvas_edit.
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": {
"ops": "<ops>"
},
"name": "canvas_draw"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | operations {k, ...}; see canvas_schema | |
| defs | No | shapes said once, {name: shape}; then "$name" wherever path data goes in this call | |
| look | No | the after preview as canvas_look would show it: {frame (an artboard), view {x, y, w, h}, focus [names], time, strip, span, shot} (alone, it asks for preview after). With no frame, view or focus, a call that painted inside one artboard previews that artboard. With mode validate: a dry run, nothing saved or shown to people | |
| mode | No | forgiving applies usable items (default), validate saves nothing, atomic applies all or none | |
| next | No | what your next call will paint ("the animals, zone by zone"): shown to people watching while they wait | |
| note | No | ||
| canvas | No | a canvas link or id; default the open one | |
| preview | No | Attach a PNG after, or before and after | |
| request_id | No | your own id for this call (a UUID): sent again after a timeout or a dropped connection, the call is not made twice; the reply says it was made the first time | |
| working_on | No | what you are about to change: object names, kit fields ("kit.colors.accent") or frames; people watching see them marked as being worked on, and canvas_open tells a second assistant, for a minute or until your next call. A soft claim, not a lock | |
| model_label | No | Optional public model name for the painting cursor, labeled as reported. Use only if your client knows it. | |
| preview_width | No | Pixels across for the preview (default 480; alone, it asks for preview after) | |
| expected_revision | No | Apply only at this drawing revision |