genart.dev
MCP ToolsCapture & Layout

capture_screenshot

Capture a PNG screenshot of a sketch, multiple sketches, or the workspace viewport — the verification step in the create→capture→analyze→fix loop.

Input Schema

ParameterTypeRequiredDescription
target'selected' | 'sketch' | 'workspace' | 'viewport'noWhat to capture (default: 'selected')
sketchIdstringnoRequired when target is 'sketch'
widthnumbernoOutput image width in pixels (default: sketch canvas width)
heightnumbernoOutput image height in pixels (default: sketch canvas height)
seednumbernoOverride seed for this capture only (doesn't mutate sketch state)
paramsobjectnoOverride params for this capture only (doesn't mutate sketch state)
format'png' | 'base64'noOutput format (default: 'base64')
savePathstringnoIf provided, save PNG to this path in addition to returning

Output Shape

{
  "success": true,
  "target": "selected",
  "sketchId": "noise-grid",
  "width": 1200,
  "height": 1200,
  "seed": 42,
  "image": "data:image/png;base64,iVBORw0KGgo...",
  "savedTo": null
}

For target: 'workspace', returns a composite image of all visible artboards at their canvas positions. For target: 'viewport', returns what's currently visible in the viewport at the current zoom level.

Side Effects

  • If savePath provided: writes PNG file to disk
  • Does not mutate sketch state (seed/param overrides are temporary)

Error Cases

ConditionError
target is 'selected' but nothing selected"No sketch is currently selected"
target is 'sketch' but no sketchId"sketchId is required when target is 'sketch'"
sketchId not found in workspace"Sketch not found: 'bad-id'"
Renderer fails to produce frame"Renderer error for 'noise-grid': [error message]"
No workspace open"No workspace is currently open"

Golden Path Example

Request:

{
  "target": "selected",
  "seed": 99999
}

Response:

{
  "success": true,
  "target": "selected",
  "sketchId": "noise-grid",
  "width": 1200,
  "height": 1200,
  "seed": 99999,
  "image": "data:image/png;base64,iVBORw0KGgo...",
  "savedTo": null
}