Skip to content

MCP server reference ​

molen mcp starts a Model Context Protocol server over stdio that mirrors the CLI 1:1 — 45 tools over the same ops library, so an agent gets the identical behaviour with no shell parsing.

json
{
  "mcpServers": {
    "molen": { "command": "molen", "args": ["mcp"] }
  }
}

Discovery first

Call describe_op before guessing an I/O contract — it returns the entry below for any op at runtime, so an agent never has to read engine source.

Tools that return rendered PNGs as MCP image content (an agent can look at its own output): drive_scene, play_experience, screenshot_asset, worldgen_preview, figure_preview.

Validate and discover ​

Cheap, fast checks you run constantly. validate gives pinpointed, fixable errors; the rest let an agent learn the surface without reading source.

validate_asset ​

Validate a JSON asset against its schema (kind auto-detected from the envelope).

FieldTypeRequiredDescription
pathstringnoPath to a JSON document (or pass inline over MCP).
inlineobjectnoValidate this inline document instead of reading a path (MCP).
kindstringnoForce a schema kind; otherwise detected from "format".
projectPathstringnoProject manifest for scene type references (default: discovered from the scene path).
verifyFilesbooleannoFor terrain-package manifests, stream-check file containment, size, and SHA-256.
CLI equivalent: molen validate.

list_schemas ​

List all registered asset schema kinds.

No parameters. CLI equivalent: molen schema.

get_schema ​

Get a schema kind: JSON Schema + examples + docs reference.

FieldTypeRequiredDescription
kindstringyesSchema kind, e.g. scene, command, assert.
CLI equivalent: molen schema.

list_components ​

List the known component vocabulary (name, description, owning layer).

FieldTypeRequiredDescription
projectPathstringnoExplicit project.json (default: walk up from cwd).
scenePathstringnoA scene manifest whose custom components extend the vocabulary.
CLI equivalent: molen components.

get_component ​

Get one component schema + examples.

FieldTypeRequiredDescription
namestringyesComponent name, e.g. transform, collider.
projectPathstringnoExplicit project.json (default: walk up from cwd).
scenePathstringnoA scene manifest whose custom components extend the vocabulary.
CLI equivalent: molen component.

describe_op ​

Machine-readable contracts for every molen operation (CLI + MCP).

FieldTypeRequiredDescription
namestringnoOp/tool name or CLI fragment; omit for the full catalog.
CLI equivalent: molen describe.

search_docs ​

Lexical search over the shipped engine docs (docs-src bundle).

FieldTypeRequiredDescription
querystringyesSearch terms.
kint>0noMax results (default 5).
includeDesignbooleannoAlso search the docs/ design plan (tagged).
CLI equivalent: molen docs.

Simulate and verify ​

The headless inner loop. Every run is deterministic, so a state hash is a meaningful regression signal and a replay mismatch localizes the diverging tick.

run_simulation ​

Run a scene headlessly for N ticks; returns tick, state hash, events, assertions.

FieldTypeRequiredDescription
scenePathstringyesPath to a scene manifest JSON.
ticksint>0yesNumber of ticks to simulate.
commandsPathstringnoJSON array (or {commands:[...]}) of command envelopes.
assertPathstringnoA molen/assert@1 document to evaluate after the run.
setupModulestringnoESM module exporting setup(world, manifest).
projectPathstringnoExplicit project.json (default: walk up from cwd).
CLI equivalent: molen sim.

run_replay ​

Replay a fixture and compare the state hash; localizes divergence on mismatch.

FieldTypeRequiredDescription
pathstringyesPath to a *.replay.json fixture.
setupModulestringnoESM module exporting setup(world, manifest).
projectPathstringnoExplicit project.json (default: walk up from cwd).
recordbooleannoRegenerate expected hashes from the current build.
CLI equivalent: molen replay.

diff_snapshots ​

Component-level diff between two keyframe JSON files.

FieldTypeRequiredDescription
astringyesBefore keyframe path.
bstringyesAfter keyframe path.
CLI equivalent: molen diff.

test_types ​

Smoke-test every registry type standalone: resolved shape validates, spawns, and survives N simulated ticks.

FieldTypeRequiredDescription
ticksint>0noTicks to simulate each type (default 30).
onlystring[]noRestrict to these type ids.
projectPathstringnoExplicit project.json (default: walk up from cwd).
cwdstringnoDirectory to discover the project from (default: process.cwd()).
CLI equivalent: molen types.

Render and play ​

Turn a scene into pixels without a browser — or drive a real built app with scripted input and collect screenshots and diagnostics.

screenshot_scene ​

Render one deterministic headless PNG of a scene; returns render stats.

FieldTypeRequiredDescription
scenePathstringyesPath to a scene manifest JSON.
outPathstringyesOutput PNG path.
ticksint>=0noTick to simulate to before snapshotting (default 0).
setupModulestringnoESM module exporting setup(world, manifest).
camera{position,lookAt}noCamera position and optional look-at target.
size[w,h]noImage size (default 1280x720).
clearColorstringnoBackground colour (CSS/hex) instead of the scene default.
projectPathstringnoExplicit project.json (default: walk up from cwd).
assetVariantstringnoRender packed asset variants (e.g. "ktx2" from asset pack) where present.
terrain{descriptorPath,heightmapPath}noRender a terrain descriptor + heightmap.
CLI equivalent: molen shot.

export_frames ​

Render a tick range to a PNG sequence, optionally following a camera track.

FieldTypeRequiredDescription
scenePathstringyesScene manifest path.
outDirstringyesOutput directory.
fromint>=0yesFirst tick.
toint>=0yesLast tick.
stepint>0noTick stride between frames (default 1).
setupModulestringnoESM module exporting setup(world, manifest).
trackPathstringnoCamera track JSON followed across the range.
camera{position,lookAt}noFixed camera when no track is given.
size[w,h]noImage size (default 1280x720).
projectPathstringnoExplicit project.json (default: walk up from cwd).
CLI equivalent: molen frames.

drive_scene ​

PLAY a scene deterministically: commands in at chosen ticks, screenshot frames out — a repeatable scenario the agent can look at.

FieldTypeRequiredDescription
scenePathstringyesScene file path or project scene name.
actions[{at, command?, screenshot?, camera?}]yesTick-ordered actions: submit a command and/or capture a named frame.
untilint>=0noStep to this tick after the last action.
assertPathstringnomolen/assert@1 doc evaluated at the end.
setupModulestringnoESM module exporting setup(world, manifest).
size[w,h]noFrame size (default 1280x720).
outDirstringnoOutput directory for the frames (MCP returns them as images).
projectPathstringnoExplicit project.json (default: walk up from cwd).
CLI equivalent: molen drive.

play_experience ​

PLAY a built browser experience: timed inputs in, screenshots/probes/diagnostics out.

FieldTypeRequiredDescription
appDirstringyesBuilt browser app directory containing index.html.
scenariomolen/experience-play@1yesDeclarative waits, keyboard input, drags, UI actions, probes, and screenshots.
outDirstringnoOutput directory for frames and experience-run.json (MCP uses a temp dir).
CLI equivalent: molen play.

screenshot_asset ​

Render an imported asset from N turntable angles (framed from its sidecar bounds).

FieldTypeRequiredDescription
refstringyesProject asset id or sidecar path.
anglesint>0noTurntable angle count (default 4).
size[w,h]noFrame size (default 1280x720).
projectPathstringnoExplicit project.json (default: walk up from cwd).
clipstringnoPose this animation clip.
clipTimenumber>=0noClip time in seconds (default 0).
assetVariantstringnoRender this packed variant (e.g. "ktx2") instead of the canonical GLB.
CLI equivalent: molen asset.

Projects and types ​

Scaffold an experience (the starter, or a copy of a shipped sample) and manage the namespaced entity type registry.

new_experience ​

Scaffold a new experience (scene + scripts + commands + checks + AGENTS.md) ready for the loop, or a standalone copy of a shipped sample with --template.

FieldTypeRequiredDescription
namestringyesExperience name (also the output folder name).
templatestringnoCopy this sample instead of the built-in starter (list_templates / molen templates lists the ids).
dirstringnoParent directory (default: cwd).
forcebooleannoReplace existing scaffold-owned files (default false).
CLI equivalent: molen new.

list_templates ​

List the sample templates new_experience can copy (id + one-line description); each scaffolds as a standalone npm project.

No parameters. CLI equivalent: molen templates.

get_project ​

Show the surrounding project.json: scenes, types, assets, reservations.

FieldTypeRequiredDescription
projectPathstringnoExplicit project.json (default: walk up from cwd).
cwdstringnoDirectory to discover the project from (default: process.cwd()).
CLI equivalent: molen project.

list_types ​

List the entity types registered in the project type registry.

FieldTypeRequiredDescription
projectPathstringnoExplicit project.json (default: walk up from cwd).
cwdstringnoDirectory to discover the project from (default: process.cwd()).
CLI equivalent: molen types.

check_types ​

Validate the type registry: duplicates, cycles, namespace ownership, asset refs, codegen staleness.

FieldTypeRequiredDescription
projectPathstringnoExplicit project.json (default: walk up from cwd).
cwdstringnoDirectory to discover the project from (default: process.cwd()).
CLI equivalent: molen types.

reserve_type ​

Reserve a type/asset id namespace for an owner (multi-agent vocabulary partitioning).

FieldTypeRequiredDescription
namespacestringyesDotted namespace, e.g. "train".
ownerstringyesOwner identity, e.g. "agent:layout".
notestringnoFree-form note recorded with the reservation.
projectPathstringnoExplicit project.json (default: walk up from cwd).
cwdstringnoDirectory to discover the project from (default: process.cwd()).
CLI equivalent: molen types.

generate_types ​

Generate (or verify) the typed component/type-id module plus the ambient types beside each scripts directory.

FieldTypeRequiredDescription
checkbooleannoCompare only; fail when a committed artifact is stale.
outstringnoOutput path override (default: project codegen.out).
projectPathstringnoExplicit project.json (default: walk up from cwd).
cwdstringnoDirectory to discover the project from (default: process.cwd()).
CLI equivalent: molen types.

Assets ​

Import glTF/GLB, inspect what was imported, and stage runtime bundles for the browser.

import_asset ​

Import a glTF/GLB: normalize, extract bounds + collision (hulls/trimesh), write the asset sidecar, register in project.json.

FieldTypeRequiredDescription
pathstringyesSource .glb/.gltf file.
idstringnoAsset id (default: slugged filename; dotted ids join a namespace).
trimeshbooleannoAlso extract a whole-asset collision trimesh (collision.bin).
optimizebooleannoNormalize pass dedup/prune/weld/quantize (default true).
outDirstringnoAssets root override; retains root/id layout. Mutually exclusive with assetDir.
assetDirstringnoExact bundle directory, relative to cwd. Mutually exclusive with outDir. Omit both to preserve an existing project asset directory.
projectPathstringnoproject.json to register into. Required when the source file sits in a different project than the cwd.
cwdstringnoDirectory to discover the project from (default: process.cwd()).
forcebooleannoReplace an existing asset directory (default false).
CLI equivalent: molen asset.

inspect_asset ​

Read + validate an asset sidecar (by path or project asset id); --verify re-hashes files.

FieldTypeRequiredDescription
refstringyesSidecar path or registered asset id.
verifybooleannoRe-hash model.glb / collision.bin against the sidecar.
projectPathstringnoExplicit project.json (default: walk up from cwd).
CLI equivalent: molen asset.

list_assets ​

List the assets registered in the surrounding project.

FieldTypeRequiredDescription
projectPathstringnoExplicit project.json (default: walk up from cwd).
cwdstringnoDirectory to discover the project from (default: process.cwd()).
CLI equivalent: molen asset.

pack_asset ​

Derive a RUNTIME GLB variant: textures re-encoded as KTX2 (Basis) with mipmaps, power-of-two sized, so the GPU gets ASTC/BC7 instead of RGBA8 (4-8x less texture memory). Recorded as files.variants.<variant>.

FieldTypeRequiredDescription
refstringnoProject asset id or sidecar path (or pass all: true).
allbooleannoPack every asset registered in the project.
variantstringnoVariant name / file suffix (default "ktx2").
mode`autoetc1suastc`
maxSizeint>=4noLongest texture side after resizing (default 2048).
powerOfTwobooleannoSnap sides to a power of two (default true).
etc1sQualityint 1..255noETC1S quality (default 128).
uastcQualityint 0..4noUASTC pack quality (default 2).
projectPathstringnoExplicit project.json (default: walk up from cwd).
CLI equivalent: molen asset.

stage_assets ​

Copy registered assets' runtime files (packed variant when requested) into a browser-servable directory and write assets.index.json (id -> URL). Fails on stale assets.

FieldTypeRequiredDescription
outDirstringyesOutput directory (created).
variantstringnoStage this packed variant instead of the main GLB.
requireVariantbooleannoFail when an asset lacks the variant (default: warn).
cleanbooleannoRemove a previous staging output first (default false).
projectPathstringnoExplicit project.json (default: walk up from cwd).
CLI equivalent: molen asset.

Audio ​

Hear what a scene would play without a browser, and build sound banks with provenance.

plan_audio ​

Run a scene headlessly and list the sounds it would play: looping voices with start/stop ticks, peak gain and pitch range, one-shots by tick, audio.* script events, and unknown sound ids or signals. Hear a scene's audio annotations without a browser.

FieldTypeRequiredDescription
scenePathstringyesScene file path or project scene name.
ticksint>0yesTicks to simulate.
bankPathsstring[]nomolen/soundbank@1 files (default: every provides.soundbank in the project's packs).
commandsPathstringnoJSON array (or {commands:[...]}) of command envelopes.
setupModulestringnoESM module exporting setup(world, manifest).
listenerstringnoEntity whose transform is the listener (default: the scene camera).
modestringnolistener.mode for rules: walk, drive, fly…
weatherstringnoWeather profile: sunny, partly-cloudy, overcast, rain, snow, fog.
daylightnumbernosky.daylight 0 (night) – 1 (day); default 1.
projectPathstringnoExplicit project.json (default: walk up from cwd).
CLI equivalent: molen audio.

import_sound ​

Add an audio clip to a molen/soundbank@1 file: copy it beside the bank, hash it, probe its duration, and record license and provenance. --append adds a variation to an existing sound.

FieldTypeRequiredDescription
filestringyesAudio file (MP3 recommended; WAV and Ogg accepted).
idstringyesSound id, e.g. "ambience.rain.medium".
bankPathstringyesSound bank JSON to update (created when missing).
licensestringyesSPDX license of the recording, e.g. "CC0-1.0".
sourcestringnoPage of the original recording.
sitestringnoOrigin site: freesound, kenney, opengameart, …
authorstringnoRecordist or creator.
promptstringnoGeneration prompt, for generated clips.
generatorstringnoGenerator/model name, for generated clips.
descriptionstringnoWhat it sounds like (agents choose sounds by it).
loopbooleannoLoop the clip (ambience, engines).
loopStartnumbernoLoop start in seconds.
loopEndnumbernoLoop end in seconds.
busstringnoDefault bus: music, ambience, sfx, ui, voice.
gainnumbernoBase gain (default 1).
durationSnumbernoDuration in seconds; overrides the probed value.
appendbooleannoAdd as another variation of an existing sound.
copyTostringnoDirectory under the bank for copied files (default audio).
CLI equivalent: molen audio.

check_soundbank ​

Check a molen/soundbank@1 file and every clip it names: files present, hashes unchanged, durations and loop points consistent, provenance recorded; prints a license summary.

FieldTypeRequiredDescription
bankPathstringyesSound bank JSON.
CLI equivalent: molen audio.

Materials and textures ​

Bake procedural material graphs and round-trip hand-painted UV templates.

rasterize_material ​

Bake a material graph / palette ref to a PNG texture.

FieldTypeRequiredDescription
pathstringnoMaterial graph JSON path.
inlineobjectnoAn inline molen/matgraph@1 document (MCP).
refstringnoA material ref, e.g. palette:#rrggbb.
outPathstringyesOutput PNG path.
CLI equivalent: molen material.

apply_uv_paint ​

Import a painted UV template: mask to the island map and dilate the gutters.

FieldTypeRequiredDescription
paintedPathstringyesPainted texture (from an image model).
islandMapPathstringyesIsland map (flat-filled islands on a dark background).
outPathstringyesOutput PNG path.
maskToIslandsbooleannoMask paint to the islands (default true).
dilationPxint>=0noGutter dilation in pixels.
CLI equivalent: molen uvpaint.

Worldgen ​

Outlines and labeled polygons into styled buildings and deterministic props.

worldgen_preview ​

Generate buildings from a style pack in Node and render them headlessly (turntable PNGs). Default batch: one building of every footprint class.

FieldTypeRequiredDescription
stylePathstringnoA standalone molen/archstyle@1 document to preview.
packPathstringnoStyle pack: a stylepack.json or its directory, or a content pack file, URL or source directory (default: the project's content packs).
styleIdstringnoForce every building onto this style id.
batchPathstringnoA molen/worldgen-batch@1 document (default: the lineup).
scatterIdstringnoScatter rule set for the batch scatter request.
ground`'flat''slope'`no
anglesint>0noTurntable angles (default 1).
size[w,h]noViewport in pixels (default 1280x720).
outPathstringnoPNG path (CLI: --out); MCP returns the images directly.
CLI equivalent: molen worldgen.

worldgen_bake ​

Generate buildings from a batch document or one outline and bake them to a glTF asset with a molen/asset@1 sidecar.

FieldTypeRequiredDescription
batchPathstringnoA molen/worldgen-batch@1 document.
outlinestringnoOne building outline "x,z;x,z;..." in meters (with styleId).
styleIdstringnoStyle id for the outline, or forced onto every building.
packPathstringnoStyle pack: a stylepack.json or its directory, or a content pack file, URL or source directory (default: the project's content packs).
outDirstringyesAssets root; the asset lands in <outDir>/<id>/.
idstringnoAsset id (default: the batch name).
ground`'flat''slope'`no
projectPathstringnoExplicit project.json (default: walk up from cwd).
forcebooleannoReplace an existing asset directory.
CLI equivalent: molen worldgen.

worldgen_stats ​

Generate one real terrain-package tile in Node and report counts, histograms, sizes, timings, and determinism; optionally dump the adapted batch.

FieldTypeRequiredDescription
packagePathstringyesterrain-package.json path.
tilestringno"z/x/y" tile address (default: the package center).
autobooleannoSearch the tiles around the center for the most buildings.
packPathstringnoStyle pack: a stylepack.json or its directory, or a content pack file, URL or source directory (default: the project's content packs).
atlasPathstringnoRegion atlas: a world.atlas.json, or a content pack that provides one (default: the project's content packs).
styleIdstringnoForce every building onto this style id.
quality`'economy''balanced''high'`
dumpPathstringnoWrite the adapted molen/worldgen-batch@1 here.
CLI equivalent: molen worldgen.

Ambient life ​

Bake real road, rail and path networks so NPC traffic can run in any scene.

network_bake ​

Bake the roads, railways and paths of a local terrain package into a molen/transport-network@1 document for ambient traffic in scenes without map tiles.

FieldTypeRequiredDescription
packagePathstringyesterrain-package.json path (local PMTiles archives).
tilestringnoCentre tile "z/x/y" at the finest features level.
radiusnumbernoTiles around the centre tile to include (default 0).
bboxnumber[4]noArea [west, south, east, north] in degrees, instead of tile.
classesstring[]noClasses to keep: 'road', 'rail', 'path' (default all).
outPathstringyesWrite the transport-network document here.
heightsbooleannoInclude surface heights from the elevation (default flat).
CLI equivalent: molen network.

Figures ​

Stylized humans, bipeds and quadrupeds: presets, descriptors, rigs and gaits.

figure_preview ​

Render figure presets, a molen/figure@1 descriptor, or a built-in lineup headlessly from turntable angles or the art-review view set (PNGs).

FieldTypeRequiredDescription
preset`stringstring[]`no
descriptorPathstringnoA molen/figure@1 document to render.
descriptorobjectnoAn inline descriptor (the figure component shape).
lineup`'humans''bodies''species'
mode`'idle''walk''run'
tickint>=0noSimulation tick to pose at (default 15).
tier`012`
angles`int>0'review'`no
size[w,h]noViewport in pixels (default 1280x720).
outPathstringnoPNG path (CLI: --out); MCP returns the images directly.
CLI equivalent: molen figure.

list_figure_presets ​

List the shipped figure presets with their resolved descriptors.

FieldTypeRequiredDescription
archetype`'biped''quadruped'`no
CLI equivalent: molen figure.

Other operations ​

Added since this page was last curated.

build_pack ​

Build a content pack (molen/pack@1 zip) from a source directory holding molen-pack.source.json. Writes <id>-<hash>.zip and updates index.json in outDir.

FieldTypeRequiredDescription
sourceDirstringyesPack source directory (holds molen-pack.source.json).
outDirstringyesOutput directory for the pack file and index.json.
solidbooleannoGroup small text files into compressed solid blocks (default: the source's setting).
CLI equivalent: molen pack.

inspect_pack ​

Summarize a content pack: id, version, contentHash, sizes, solid blocks, asset ids, roles and the largest files.

FieldTypeRequiredDescription
sourcestringyesBuilt pack file, pack source directory, or http(s) URL.
CLI equivalent: molen pack.

verify_pack ​

Read every file of a content pack checking CRC and sha256, validate each JSON document against its registered schema, and check asset sidecar hashes against their models.

FieldTypeRequiredDescription
sourcestringyesBuilt pack file, pack source directory, or http(s) URL.
CLI equivalent: molen pack.

extract_pack ​

Write every file of a content pack into a directory, with a molen-pack.source.json that builds it back to the same content.

FieldTypeRequiredDescription
sourcestringyesBuilt pack file or http(s) URL.
outDirstringyesDirectory to write the files into.
CLI equivalent: molen pack.

fetch_pack ​

Download content packs (a pack URL, or a molen/pack-index@1 URL) into the project, list them in index.json in the download directory (so a page can open them), and pin them in project.json packs with their contentHash, so the project runs offline.

FieldTypeRequiredDescription
urlstringyesURL of a pack file, or of a pack index.
idsstring[]noWith an index URL, fetch only these pack ids (default: all).
outDirstringnoDownload directory (default: packs/ beside project.json).
projectPathstringnoExplicit project.json (default: walk up from cwd).
cwdstringnoDirectory to discover the project from (default: process.cwd()).
CLI equivalent: molen pack.

check_scripts ​

Type-check the scene's scripts against their generated declarations: component typos, bad command payloads, unguarded reads.

FieldTypeRequiredDescription
projectPathstringnoExplicit project.json (default: walk up from cwd).
cwdstringnoDirectory to discover the project from (default: process.cwd()).
CLI equivalent: molen scripts.

37 guides · 36 schema formats · 41 API entry points · 10 samples. API, CLI and schema pages are generated from the shipped build.