genart.dev
MCP ToolsSketch Lifecycle

create_sketch

Create a new `.genart` file from metadata, parameters, philosophy, algorithm, and renderer type.

Input Schema

ParameterTypeRequiredDescription
idstringyesURL-safe kebab-case identifier
titlestringyesHuman-readable title
pathstringyesFile path (must end in .genart)
renderer'p5' | 'three' | 'glsl' | 'canvas2d' | 'svg'noRenderer type (default: 'p5')
canvas{ preset?: string, width?: number, height?: number }noCanvas dimensions (default: square-1200)
philosophystringnoMarkdown design philosophy
parametersParamDef[]noParameter definitions (default: [])
colorsColorDef[]noColor definitions (default: [])
themesThemeDef[]noTheme presets (default: [])
algorithmstringnoAlgorithm source code (default: renderer template)
seednumbernoInitial random seed (default: random)
skillsstring[]noDesign skill references
addToWorkspacestringnoPath to workspace to add sketch to after creation

Output Shape

{
  "success": true,
  "path": "/absolute/path/to/sketch.genart",
  "id": "my-sketch",
  "title": "My Sketch",
  "renderer": "p5",
  "canvas": { "width": 1200, "height": 1200 },
  "seed": 42
}

Side Effects

  • Creates .genart file on disk at path
  • If addToWorkspace specified: modifies the workspace file to include the new sketch
  • Does not create directories

Error Cases

ConditionError
path doesn't end in .genart"Path must end with .genart"
id contains invalid characters"ID must be kebab-case: lowercase letters, numbers, hyphens"
File already exists at path"File already exists at /path/to/sketch.genart. Use update_sketch or fork_sketch."
Unknown renderer type"Unknown renderer type: 'unity'. Valid types: p5, three, glsl, canvas2d, svg"
Unknown canvas preset"Unknown canvas preset: 'giant'. Use list of valid presets."
Parameter default out of range"Parameter 'margin' default (999) outside range [10, 100]"
Duplicate parameter keys"Duplicate parameter key: 'margin'"
Workspace not found (if addToWorkspace)"Workspace not found: /path/to/ws.genart-workspace"

Golden Path Example

Request:

{
  "id": "noise-grid",
  "title": "Noise Grid",
  "path": "~/projects/genart/outputs/noise-grid.genart",
  "renderer": "p5",
  "canvas": { "preset": "square-1200" },
  "philosophy": "# Noise Grid\n\nA grid of cells colored by Perlin noise.",
  "parameters": [
    { "key": "cells", "label": "Cells", "min": 4, "max": 32, "step": 1, "default": 12 }
  ],
  "colors": [
    { "key": "bg", "label": "Background", "default": "#1a1a1a" }
  ],
  "algorithm": "function sketch(p, state) {\n  p.setup = () => {\n    p.createCanvas(state.canvas.width, state.canvas.height);\n    p.randomSeed(state.seed);\n    p.noiseSeed(state.seed);\n  };\n  p.draw = () => {\n    p.background(state.colorPalette[0]);\n    const n = state.params.cells;\n    const w = p.width / n;\n    for (let i = 0; i < n; i++)\n      for (let j = 0; j < n; j++) {\n        p.fill(p.noise(i*0.1, j*0.1) * 255);\n        p.rect(i*w, j*w, w*0.9, w*0.9);\n      }\n    p.noLoop();\n  };\n  return { initializeSystem() {} };\n}"
}

Response:

{
  "success": true,
  "path": "/Users/et/projects/genart/outputs/noise-grid.genart",
  "id": "noise-grid",
  "title": "Noise Grid",
  "renderer": "p5",
  "canvas": { "width": 1200, "height": 1200 },
  "seed": 58291
}