Token footprint: 721o200k tokens across all 4 tool definitions (hard contributor ceiling < 800).
MCP tools
Tool
Arguments
Defaults / behavior
eval
{ code: string, strict?: boolean }
strict defaults to true. Executes Forma-Pipe transactionally with auto-rollback on error or strict invariant failure. Scalar variables persist across calls (and roll back with tx); _-prefixed mesh vars stay local. Embeds SPEC_PIPE in the tool description.
Writes .glb, .step, .3mf, .stl, .obj, .svg, .blend (via local Blender bridge), or .png (size defaults to 512). When scene: true, exports or renders all named parts together (.glb, .blend, .png, or .svg).
JavaScript / TypeScript / Edge WASM API (forma-3d)
Zero runtime dependencies and zero top-level node:* imports.
session.exportBytes(format, opts?: { part?: string; size?: number }): Uint8Array: exports a single part or visual render.
session.exportSceneBytes(): Uint8Array: exports all named parts as a multi-node .glb scene graph.
session.invariants(part?: string): FormaInvariants: returns structured invariants for the specified or last-modified part.
session.free(): void: releases the WASM-allocated session handle.
Trap recovery: If any WASM call throws WebAssembly.RuntimeError (e.g. out-of-memory), FormaEngine automatically evicts itself from internal caches so subsequent calls instantiate a clean WebAssembly.Instance.
forma-server HTTP/1.1 API (opt-in crate)
Binary built with cargo build --profile static-release -p forma-server (excluded from default-members).
Configuration
CLI flag
Environment variable
Default
Constraints
--bind, -b
FORMA_BIND
127.0.0.1:8080 (Dockerfile sets 0.0.0.0:8080)
TCP host:port bind address.
--workers, -w
FORMA_WORKERS
available_parallelism().clamp(1, 8)
Clamped to 1..=64.
Routes
Method and path
Request
Response
GET /health
None
200 OK JSON: {"status":"ok","version":"0.4.5","workers":N}
GET /spec
Optional query gbnf=1, dialect=compact, or topic=<name>
scale accepts a uniform number or [sx, sy, sz]; target_faces works with or without decimate. Returns binary mesh/render (output_format defaults to "glb") + X-Forma-* headers.
Binary response headers
X-Forma-Exec-Ms: execution duration in milliseconds.
X-Forma-Watertight: true or false.
X-Forma-NonManifold: integer count of non-manifold edges.
X-Forma-Verts: integer vertex count.
X-Forma-Faces: integer face count.
Hardcoded limits and error status codes
Limit / guard
Value in crates/forma-server/src/main.rs
HTTP status on violation
Host filesystem access
scene.allow_fs_import = false (assets via base64 only)