# The paprika3d tools
https://paprika3d.com/docs/tools

The page tools work on the page `open` opened in headless Chrome; `reference` (apart from its `compare`), `model_audit`, `model_run`, `model_look`, `asset_search`, `sheet`, `publish` and `send_feedback` need no page open. The names and descriptions below are the ones the MCP server registers, read from `src/server.ts` and `src/telemetry.ts` at build time.

| Tool | What it does |
|---|---|
| `open` | Opens a three.js, React Three Fiber or WebGL page (a game, viewer, configurator, simulation or shader demo) in headless Chrome (or the `browser` given) on a paused, seeded clock, closing any page already open under the same `game` name, and lists the asset files (models, textures, sounds) it fetched and any fetch that failed, what a dev-server `command` printed as an error or warning, a canvas with no height, and the page's text outside the canvas. Open once: after an edit, the next `interact`, `look`, `observe`, `eval` or `feel` reloads the page by itself. Use it when such a page has been written or changed. Give a file or folder to serve (`url`, relative to cwd), an http URL, or a dev-server `command` run in cwd. It writes geo.js and fx.js into a served folder, never over a newer copy. Up to 4 games can be open at once, each under its own `game` name: a subagent opens its own (`game: "tester"`) and passes that name to every call. |
| `observe` | Reads the open page's state as JSON (window.__game.observe(), or its named three.js objects), renderer counts, new console errors and what changed since the last observe. |
| `eval` | Runs JavaScript in the open page and returns what it returns, as JSON, then up to 5 lines it logged (console.log, warn, info) and up to 5 console errors. In scope: scene, camera, renderer, find(name), stats(target) (vertices, triangles, bounds, closed, volume, genus per mesh), realNow(), window, and THREE on a page that loads three through an import map. performance.now, Date and timers run on the harness's paused clock (code that awaits a timer or frame steps it until done), so to time code here use realNow() (real milliseconds), and end GPU work before reading it (a 1-pixel gl.readPixels; on WebGPU, await renderer.backend.device.queue.onSubmittedWorkDone()). Use it to inspect the scene, try a change before writing it into the source, measure an imported model, or check procedural geometry with stats after each step; changes vanish on reload. A thrown error names where it threw: a line of this code or of the page's own files. Code that keeps the page busy for 30 s (longer on a busy host) is stopped and the page kept: split long work across calls, or await a 0 ms timer every few hundred iterations. |
| `interact` | Plays `steps` on the open page frame by frame and returns what changed in the state (the whole state when nothing did), the console lines and errors the steps raised, a Motion line when the subject turned or stopped under a held key or would stutter on a 100 Hz screen, and a Sound line on a page that makes sound. Each mouse and touch step names the object under it and its distance. `expect` adds one ✓ or ✗ line per path; `save` keeps the play as a check `test` reruns, only when every entry holds. A malformed step fails the call before anything plays; a failing `expect` entry is reported, not raised. Use `feel` to measure how an event reacts on screen, `observe` to read the state without playing, and `eval` to set it with code. Options in full: the skill's references/tools.md. |
| `look` | Screenshot of the open page in the reply, an ID image beside it (one colour per object, the path with -ids before .png), and a list of what is on screen and the named objects no look has seen, with size and place. It sends no input; sheet, scroll, viewports and compare reload the page for their pictures. One mode a call: cameras, viewports, scroll, sheet, opening, zoom, at, target, save or compare. It ends with the lines the skill's references/lighting.md explains, the `Lighting:` and `Surfaces:` setup faults among them. A post-processed page is pictured as of its last drawn frame, so state set since shows after a step. Use `observe` for the state as numbers, `reference` to read or match a picture the page should look like, and `interact` with `look: true` for the picture after input. Modes in full: references/tools.md. |
| `feel` | Measures game feel, how the page reacts to an event: on a fresh reload, sends the steps, then watches the next frames for camera shake or one camera move out and back (a hit's lurch), scale pops, smooth moves versus teleports, colour flashes, particles (a Points pool's or an InstancedMesh's count), spawned objects, HUD text ticks and sounds, each with the watched frame it came on. Leading { state } steps set the scene up (the player next to the coin), and nothing is measured until they and one frame have run; what moved during the other steps is listed as a fact on its own line, and teleports are jumps between two watched frames, so a setup or a walk in the steps is never one. It shows whether each event a feel brief names (hits, clears, explosions, pickups, deaths, wins) reacts on screen, and whether anything teleports. It measures and saves nothing: to keep the play as a check, send the same steps to `interact` with `expect` and `save`. |
| `perf` | Measures the open page's frame time (fps), draw calls, triangles and asset size against a budget (desktop by default): it is for a frame a reply reports over budget, or a user who asks about performance (stutter, low fps). To find what costs the frame, give `variants`: each is measured on a fresh page against the baseline, in this one call, with named objects hidden, a pixel ratio, code run with `renderer` and `scene` (shadows or antialias off, a material swapped), or a `query` the page loads with ("noshadow&pr=0.5", for switches the game reads at load); no reopening or reload code needed. Sampling waits until no element covers the canvas (a loading screen), up to 15 s of the page running, and the load line says what it waited for or sampled under. With `optimize: true` it instead tries the @paprika3d/three-runtime switches one at a time: `resolution` (lowers the pixel ratio while frames run over budget), `defaults` (pixel ratio capped at 2, shaders compiled up front, shadow maps redrawn only when a caster moves), `instancing` (still meshes that share a geometry and material drawn as one), `lod` (simpler versions of meshes over 10,000 triangles at a distance) and `dispose` (frees the GPU memory of removed objects). `instancing` and `lod` stay only when frames get faster, the others unless they slow frames. A switch is reverted if a saved test that passed without it fails with it, and `defaults`, `instancing` and `dispose` also if they change the picture; a kept `resolution` or `lod` that changes it comes with before and after pictures. What it keeps goes in the project's game-runtime.json, which the runtime reads at every load, so it lasts until that file changes; it ends with the final `test` of game-tests.json when the project has one. On a game without the runtime it changes nothing and says how to import it. |
| `model_audit` | Inspects 3D model files (.glb, .gltf, and USD: .usd, .usda, .usdc, .usdz): megabytes, triangles, materials, each texture's size and format, and whether it uses Draco, meshopt and KTX2, for one file or every one under a folder (`path`, relative to cwd; the whole project when left out), read from the file itself with no decoder, so Draco and meshopt files report too. Then a one-line verdict on what a website or a Shopify listing judges a model on, against `target`: `site` (the site budget: 4 MB of assets, 200,000 triangles, 2048 px textures by area) or `shopify` (a GLB of about 4 MB with textures at most 2048 px on a side). `shrink` rewrites one .glb or .gltf smaller, without its textures or with each capped at a size (WebP), decimated to about a triangle count (welded or not), or without nodes named in `drop`, and replies with before and after (a USD file is converted to GLB first); a failing file gets the shrink call that fixes it: save a look first (`look` `save`), shrink, point the page at the new file, then `look` `compare`. |
| `model_run` | Runs JavaScript against the modelling scene: a three.js scene this server keeps between calls, apart from any page, for building a model in code as in Blender, then saving it as a .glb the page loads. The code is an async function body with THREE, BufferGeometryUtils (mergeGeometries, mergeVertices), scene, geo (Manifold, started: geo.Manifold, geo.CrossSection, geo.toGeometry(manifold), geo.toManifold(geometry), geo.boolean(op, a, ...b)), scatter, find(name), stats(target) (vertices, triangles, bounds, closed, volume, genus per mesh), load(path) (a .glb, .obj or .fbx from the project, an asset_search pick included, added to the scene and returned), save(path, object = scene) (a GLB under cwd; replies with its size and the line that loads it) and clear() in scope, and returns what it returns, as JSON, with up to 5 lines it logged. What it adds to scene stays for the next call and is saved to paprika3d/model/scene.glb after each run that changed it, so a restart loads it back; variables (a Manifold) do not last between calls. Manifold works in metres with Z up and angles in degrees; three is Y up. Name every object you make: model_look lists them by name. Search `asset_search` first for a character, vehicle, building, plant or prop; build here what no search finds or the design makes by rule, saying why in `searched`. |
| `model_look` | Shows the modelling scene that `model_run` builds: one picture of it (or of `object`) from the front, right and top (orthographic, so sizes read true against the grid) and a three-quarter view, under a neutral studio light with a ground grid whose step it states, and one line per object: name, type, place, turn and scale, material (colour, roughness, metalness) and, for a mesh, triangles, size, whether it is closed, its volume and genus. With `object`, that object in full; with `cameras`, those views instead of the four. |
| `unity_export` | Writes the open page's three.js scene, at the frame it is on, as a Unity 6 project: the GLB (three's GLTFExporter: meshes, hierarchy, names, PBR materials and textures, lights, animations, skins, instancing, the camera), glTFast as its importer, an editor script that builds the Unity scene from it on the first open (hidden objects, background, fog, ambient light), GameState.cs from __game.observe(), and PORTING.md: what does not carry over (custom shaders, sprites, compressed and canvas textures, environment maps; named in the reply) and what to port by hand (game loop, input, physics, UI, sound). Gameplay code is not converted. The GLB is loaded back in the page and counted; Unity is not run. |
| `test` | Reruns every check saved with `interact` `save` (game-tests.json) on the open page, each from a fresh reload at frame 0, one line each: `✓ pickup` or `✗ jump: player.y 1.4, expected ≥ 2`. Use it after an edit that could break earlier features. |
| `reference` | Reads a reference picture the page should match (a photo, artwork, mockup or screenshot in the project, e.g. refs/01.jpg) at full resolution, in one call and with no page open: `crop` [left, top, right, bottom] in the picture's pixels, enlarged up to 4× to fit 1280 px, with `grid` lines every N px labelled in the picture's own pixel coordinates (positions read off it go straight into the next call or the scene), and `sample` points, each answered as #rrggbb. With the page open, `compare: true` puts the picture, the page's look (from `camera` when given) and a difference picture side by side and says what share of pixels differ, overall and in a grid of regions (`cells` per side, 4 by default), with each `sample` point's colour on both, or that the canvas aspect is not the picture's. Use it to read a picture the page should match and to check the page against it. |
| `asset_search` | Searches the hosted paprika3d asset library over the network (assets.keeno.dev) for a ready-made model (84,249, CC BY or CC0, as GLB and some as USD), PBR texture or HDRI sky, and puts the one you pick in the project with its loading code. A search answers one numbered line per hit (id, name, size, licence, preview image) and a contact sheet: the hits' thumbnails in one row, numbered as the lines are. `pick` an id from it (or its start, when no other hit shown in this project starts so) to download the file into assets/ (public/assets/ with vite) and get the code that loads it, a model at real size (or `height` units tall) and credited in CREDITS.md. `not` lists ids that missed, which the library learns from, and searches again without them; `more` searches the same query again for the next hits. `image` (a picture in the project, with `crop` to cut one thing out of it) ranks models by how alike they look, for the thing a reference picture shows that words miss. Search it before building any character, creature, vehicle, building, prop, surface texture or sky in code (paprika-make's picking round). Detailed models (scans, PBR packs) rank above blocky low-poly and voxel kits unless the query or `style` asks for low-poly, flat-shaded or voxel. The library logs model searches, picks and rejections with the agent's name. |
| `sheet` | Picture sheets for paprika-make's brief, and which image and 3D model keys this machine has. `check: true` names the keys found (never a value), the running jobs and, once the project has a BRIEF.md, what it and its sheets lack; `pictures` with no provider composes a free sheet in Chrome (refs/sheets/LOOK.png, or `out`); `provider` and `prompt` make a look board, or start a turnaround or GLB model job, billed to the person's key. Details: skills/paprika-make/sheets.md. |
| `publish` | Publishes the project at https://<slug>.paprika3d.app (public; preview, invite-only), only when the person asks; never for another host. Never read or print ~/.config/paprika3d/credentials.json: this tool reads the key. |

## Not in the stable build

These tools exist in the source but the published plugin does not list them:

| Tool | What it does | Availability |
|---|---|---|
| `contract` | For a game with exact rules (scoring, collisions, matching, turn order, stated numbers) or when the user asks for a locked spec or tests, call it before writing game code: it turns the user's prompt into a game contract (keypoints the game must pass). It writes a brief for a fresh subagent that has seen no game code and tells you how to start it; that subagent drafts and issues the contract and replies with the keypoints. Never edit game-contract.json by hand. | Benchmark only: the `contract` arm of the benchmark (`bench/README.md` in the development repository) lists it, until a benchmark shows the contract helps. |
| `check` | Runs the game contract against the open game, each keypoint on a fresh page. When the project has a game contract, it shows which keypoints a change broke or fixed. | Benchmark only: the `contract` arm lists it with `contract`. |
| `invariants` | Runs built-in checks any game must pass, no contract needed: the window.__game convention, plain-JSON observe(), setState round-trip, inputs change the state, no console errors, and the same inputs give the same state twice. Call it once the game opens and after any change to the game's state handling. | Benchmark only: the `lean` arm of the benchmark lists it, with `test`. |

How the tools fit together is in the [skill](https://paprika3d.com/docs/skill); what a game exposes to it is on the [convention page](https://paprika3d.com/docs/convention).

Updated 2026-11-17.
