genart.dev
MCP ToolsCapture & Layout

capture_batch

Capture PNG screenshots of multiple sketches in parallel — batch variant of `capture_screenshot` for generating thumbnails or comparison grids.

Input Schema

ParameterTypeRequiredDescription
sketchIdsstring[]noIDs of sketches to capture (default: all loaded sketches)
widthnumbernoOverride output width for all captures (default: each sketch's canvas width)
heightnumbernoOverride output height for all captures (default: each sketch's canvas height)
seednumbernoOverride seed for all captures (doesn't mutate sketch state)
format'png' | 'base64'noOutput format (default: 'base64')
savePathstringnoDirectory to save PNGs (files named {sketchId}.png)

Output Shape

{
  "success": true,
  "total": 3,
  "captured": 3,
  "failed": 0,
  "results": [
    {
      "sketchId": "noise-grid",
      "success": true,
      "width": 1200,
      "height": 1200,
      "seed": 42,
      "image": "data:image/png;base64,iVBORw0KGgo...",
      "savedTo": null
    }
  ]
}

When some captures fail, success is false and errors is included:

{
  "success": false,
  "total": 3,
  "captured": 2,
  "failed": 1,
  "results": [ ... ],
  "errors": [
    { "sketchId": "broken-sketch", "error": "Renderer error message" }
  ]
}

Side Effects

  • If savePath provided: writes PNG files to the directory as {sketchId}.png
  • Does not mutate sketch state (seed override is temporary)

Error Cases

ConditionError
No workspace open"No workspace is currently open"
No sketches to capture (empty list, empty workspace)"No sketches to capture"
A sketchId not found"Sketch not found: 'bad-id'"
Individual renderer failureCaptured in errors array, does not abort batch

Golden Path Example

Request:

{
  "sketchIds": ["noise-grid", "wave-pattern"],
  "width": 400,
  "height": 400,
  "format": "base64"
}

Response:

{
  "success": true,
  "total": 2,
  "captured": 2,
  "failed": 0,
  "results": [
    {
      "sketchId": "noise-grid",
      "success": true,
      "width": 400,
      "height": 400,
      "seed": 42,
      "image": "data:image/png;base64,iVBORw0KGgo...",
      "savedTo": null
    },
    {
      "sketchId": "wave-pattern",
      "success": true,
      "width": 400,
      "height": 400,
      "seed": 7890,
      "image": "data:image/png;base64,iVBORw0KGgo...",
      "savedTo": null
    }
  ]
}