capture_screenshot
Captures a sketch screenshot as an inline JPEG with metadata, optionally saving a full-resolution PNG; intended for single-frame canvas2d renders.
Instructions
Capture a screenshot of a sketch. Returns an inline JPEG image + metadata as text. In local mode, also writes a full-res PNG to snapshots/--preview.png (path in savedPreviewTo). When a previewUrl is present in the metadata, the full-res image is available at that URL for sharing (30-min TTL). In MCP Apps-capable clients, the captured image renders inline in the conversation.
IMPORTANT TIMING: The capture waits only 500ms after page load. For animated p5 sketches that accumulate particles/lines over many frames, the screenshot may appear mostly empty. This is NORMAL — it does NOT mean the algorithm is broken. To verify animated sketches, use preview_sketch to open in the browser instead. Only use capture_screenshot for single-frame renderers (canvas2d) or after confirming the sketch works in the browser preview.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Override seed for this capture only | |
| width | No | Output width in pixels (default: sketch canvas width) | |
| height | No | Output height in pixels (default: sketch canvas height) | |
| params | No | Override params for this capture only | |
| target | No | What to capture (default: selected) | |
| sketchId | No | Required when target is 'sketch' | |
| previewSize | No | Max dimension for inline preview JPEG (default: 400) |