Public
Voice-drawable tldraw whiteboard for the dot hub
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

whiteboard

A shared tldraw canvas dot can draw on by voice. Load dcm31/whiteboard in the dot hub (or open https://whiteboard.val.run on the tablet/TV/phone) and talk: the realtime lane calls this val's MCP tools, tools enqueue JavaScript, and the live page executes it against the real tldraw Editor.

How it moves

Rendering mermaid diagram...

The page polls every 2 seconds (jotl-tracker pattern — no websockets on Val Town). If no page is open, tool calls come back "queued — board not on screen"; load the whiteboard and retry.

Endpoints

  • GET / — the board (public view; tldraw, dark-friendly, status dot).
  • POST /cmd {code} — enqueue JS (Bearer DOT_MCP_TOKEN).
  • GET /pull — queued commands (the page's poll).
  • POST /done {id, ok, result} — the page reports a result.
  • POST /mcp — stateless streamable-HTTP MCP (Bearer DOT_MCP_TOKEN): draw_graph, run_js, get_board, get_snapshot, clear_board.

draw_graph (the mermaid-style path)

For any flowchart/diagram, don't hand-place shapes: pass a declarative graph and let dagre (imported by the board page from esm.sh) compute the layout. Arrows are elbow-routed and bound to their nodes, so the drawing survives humans dragging things around — this is the primary drawing tool.

{ "graph": { "direction": "LR", "nodes": [{ "id": "a", "label": "ARCHIVE" }, { "id": "b", "label": "SELECT" }], "edges": [{ "from": "a", "to": "b", "label": "best card" }] }, "clear": false, "zoom": true }

Node options: shape (rectangle/ellipse/diamond/hexagon…), color, fill, w/h overrides. Correctness is structural — no need to look at the board to know nothing overlaps.

  • GET /source — this code.

MCP briefing (what the model needs to know)

run_js code runs with editor (tldraw v3 Editor), createShapeId, Box and toRichText in scope; return a value to hear it back.

tldraw v3 removed the plain text prop — its validator rejects it with "Unexpected property". Every label goes through richText:

editor.createShapes([{ id: createShapeId(), type: "geo", x: 100, y: 100, props: { geo: "rectangle", w: 260, h: 120, richText: toRichText("plan"), color: "blue" } }]); editor.zoomToFit();

Text: { type: "text", props: { richText: toRichText("hi"), size: "m" } } · notes: { type: "note", props: { richText: toRichText("hi") } } · arrows: { type: "arrow", props: { start: {x,y}, end: {x,y} } } (without start/end the arrow renders zero-length).

Colors: black, grey, light-violet, violet, blue, light-blue, yellow, orange, green, light-green, light-red, red, white. Fills: none, semi, solid, pattern.

Verification loop: get_board lists every shape with label, position, size and color; get_snapshot returns the whole board as SVG so an agent can actually look at what it drew before declaring victory. Draw → snapshot → fix is the intended rhythm for anything layout-heavy.

Env

  • DOT_MCP_TOKEN — shared bearer with the dot hub (same value as dot's).

Registered in dcm31/dot/backend/registry.ts.