MCP ToolsSketch Lifecycle
create_sketch
Create a new `.genart` file from metadata, parameters, philosophy, algorithm, and renderer type.
Input Schema
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | URL-safe kebab-case identifier |
title | string | yes | Human-readable title |
path | string | yes | File path (must end in .genart) |
renderer | 'p5' | 'three' | 'glsl' | 'canvas2d' | 'svg' | no | Renderer type (default: 'p5') |
canvas | { preset?: string, width?: number, height?: number } | no | Canvas dimensions (default: square-1200) |
philosophy | string | no | Markdown design philosophy |
parameters | ParamDef[] | no | Parameter definitions (default: []) |
colors | ColorDef[] | no | Color definitions (default: []) |
themes | ThemeDef[] | no | Theme presets (default: []) |
algorithm | string | no | Algorithm source code (default: renderer template) |
seed | number | no | Initial random seed (default: random) |
skills | string[] | no | Design skill references |
addToWorkspace | string | no | Path 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
.genartfile on disk atpath - If
addToWorkspacespecified: modifies the workspace file to include the new sketch - Does not create directories
Error Cases
| Condition | Error |
|---|---|
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
}