genart.dev
MCP ToolsComponents

add_component

Add component dependency to sketch.

Input Schema

ParameterTypeRequiredDescription
sketchIdstringYesID of the sketch to add the component to.
componentstringYesName of the component to add.
versionstringNoSemver version range for the component. Default: "^1.0.0".

Output Shape

{
  "sketchId": "my-sketch-01",
  "component": "perlin-noise",
  "version": "^1.0.0",
  "added": true
}

Side Effects

  • Adds the component as a dependency in the sketch definition.
  • The component code becomes available to the sketch algorithm at render time.

Error Cases

ErrorCause
Sketch not foundThe provided sketchId does not match any saved sketch.
Component not foundThe provided component name does not match any available component.
Component already addedThe sketch already includes this component as a dependency.
Incompatible rendererThe component does not support the sketch's renderer type.

Golden Path Example

Request

{
  "sketchId": "my-sketch-01",
  "component": "perlin-noise",
  "version": "^1.0.0"
}

Response

{
  "sketchId": "my-sketch-01",
  "component": "perlin-noise",
  "version": "^1.0.0",
  "added": true
}