genart.dev
MCP ToolsSpatial Arrangement

auto_arrange

Automatically lay out all or selected sketches on the canvas using a configurable layout algorithm.

Input Schema

ParameterTypeRequiredDescription
layout'grid' | 'row' | 'column' | 'masonry'noLayout algorithm (default: 'grid')
sketchIdsstring[]noSpecific sketches to arrange (default: all sketches in workspace)
spacingnumbernoGap between sketches in pixels (default: 200)
sortBy'title' | 'created' | 'modified' | 'renderer'noSort order before arranging (default: 'created')
origin{ x: number, y: number }noTop-left origin for the arrangement (default: { x: 0, y: 0 })

Output Shape

{
  "success": true,
  "layout": "grid",
  "arranged": 6,
  "positions": [
    { "id": "sketch-a", "position": { "x": 0, "y": 0 } },
    { "id": "sketch-b", "position": { "x": 1400, "y": 0 } },
    { "id": "sketch-c", "position": { "x": 2800, "y": 0 } },
    { "id": "sketch-d", "position": { "x": 0, "y": 1400 } },
    { "id": "sketch-e", "position": { "x": 1400, "y": 1400 } },
    { "id": "sketch-f", "position": { "x": 2800, "y": 1400 } }
  ],
  "boundingBox": { "x": 0, "y": 0, "width": 4000, "height": 2600 },
  "viewport": { "x": 2000, "y": 1300, "zoom": 0.3 }
}

Layout algorithms

  • grid: Square grid, row-major. Column count = ceil(sqrt(n)). Each cell sized to the largest sketch width/height + spacing.
  • row: Single horizontal row, left to right.
  • column: Single vertical column, top to bottom.
  • masonry: Column-based masonry. Fills the shortest column first, respects varying sketch heights.

The returned viewport is a suggested viewport that fits all arranged sketches.

Side Effects

  • Updates sketch positions in the .genart-workspace file on disk
  • Updates the viewport to fit the new arrangement
  • Does not modify any .genart files

Error Cases

ConditionError
No workspace open"No workspace is currently open"
Workspace has no sketches"No sketches to arrange"
Unknown sketch ID in sketchIds"Sketch not found: 'bad-id'"
Unknown layout type"Unknown layout: 'spiral'. Valid layouts: grid, row, column, masonry"

Golden Path Example

Request:

{
  "layout": "grid",
  "spacing": 200,
  "sortBy": "title"
}

Response:

{
  "success": true,
  "layout": "grid",
  "arranged": 4,
  "positions": [
    { "id": "cadenced-fields", "position": { "x": 0, "y": 0 } },
    { "id": "felt-satzspiegel", "position": { "x": 1400, "y": 0 } },
    { "id": "orchestrated-opposition", "position": { "x": 0, "y": 1400 } },
    { "id": "parity-lattice", "position": { "x": 1400, "y": 1400 } }
  ],
  "boundingBox": { "x": 0, "y": 0, "width": 2600, "height": 2600 },
  "viewport": { "x": 1300, "y": 1300, "zoom": 0.4 }
}