genart.dev
MCP ToolsSelection & Context

get_selection

Return full context for the currently selected sketch(es) on the canvas — the key tool for AI-assisted editing.

Input Schema

ParameterTypeRequiredDescription
includeAlgorithmbooleannoInclude full algorithm source (default: true)
includePhilosophybooleannoInclude philosophy markdown (default: true)
includeNeighborsbooleannoInclude summaries of adjacent sketches (default: false)

Output Shape

{
  "selected": [
    {
      "id": "noise-grid",
      "title": "Noise Grid",
      "path": "/absolute/path/to/noise-grid.genart",
      "renderer": { "type": "p5", "version": "1.x" },
      "canvas": { "preset": "square-1200", "width": 1200, "height": 1200 },
      "state": {
        "seed": 42,
        "params": { "cells": 12 },
        "colorPalette": ["#1a1a1a"]
      },
      "parameters": [ { "key": "cells", "label": "Cells", "min": 4, "max": 32, "step": 1, "default": 12 } ],
      "colors": [ { "key": "bg", "label": "Background", "default": "#1a1a1a" } ],
      "themes": [],
      "skills": [],
      "philosophy": "# Noise Grid\n\nA grid of cells colored by Perlin noise.",
      "algorithm": "function sketch(p, state) { ... }",
      "position": { "x": 0, "y": 0 },
      "snapshotCount": 0
    }
  ],
  "workspace": {
    "id": "typography-explorations",
    "title": "Typography Explorations",
    "sketchCount": 4
  },
  "neighbors": []
}

When nothing is selected, selected is an empty array.

When includeNeighbors is true, neighbors contains summaries (id, title, renderer type, position) of sketches within 2000px of the selected sketch(es).

Side Effects

None. Read-only.

Error Cases

ConditionError
No workspace open"No workspace is currently open"

Golden Path Example

Request:

{ "includeAlgorithm": true, "includePhilosophy": true, "includeNeighbors": true }

Response: (as shown in Output Shape above)