WordCraft
Operate WordCraft through its structured automation interface. Preserve the user's requested document, styles, and editable content.
Protocol reference
Read the relevant sections of references/control-protocol.md before constructing calls. This is the downloaded upstream protocol, captured on 2026-11-02.
Source:
WordCraft control protocol. The documentation is distributed under the
bundled MIT license. Relative links inside the snapshot (e.g.
,
) resolve against
https://github.com/storytold/wordcraft/blob/main/docs/
. Discover command ids and parameter docs through
instead of inventing them.
Select the session and authenticate
Start the app with a control port:
(or
WORDCRAFT_CONTROL_PORT=7981
); it listens on
only. Every request needs the window's key: a random hex value the app writes to
<settings>/control-key.local-<port>
(macOS
~/Library/Application Support/WordCraft
, Linux
$XDG_CONFIG_HOME/wordcraft
, Windows
;
isolates the profile). Send it as top-level
on every request, or once per connection with
{"method": "auth", "key": "…"}
. A missing or wrong key answers
and closes the connection; an unauthenticated connection is dropped after 30 s.
wordcraft-cli mcp --connect
reads the key itself (or
) and only sends it to
; to drive a remote app, forward the port and set the key explicitly. Discover executables and running sessions first; this skill does not install WordCraft or configure MCP servers.
Transport
Send one JSON object per line; each gets one reply line, matched by
; check
. A failed command leaves the document unchanged. A non-JSON line gets one error reply and closes the connection; lines over 1 MiB are refused the same way. Any method name that is a command id works directly (
{"method": "format.bold"}
).
Documents and targeting
Several documents can be open, each with a stable id.
reports
and
(
,
,
,
,
).
and
open a document in its own window and make it active (
on an already-open file returns
);
activates one;
file.closeDocument {id?, force?}
closes one.
,
, and
take
to work on a background document without changing the active window; window and input methods act on the active window only.
never shows a Save prompt: with unsaved changes it errors — save first or pass
deliberately.
Inspect, edit, and verify
Inspect before editing:
document.inspect {text?, doc?}
for blocks, styles, runs, lists, tables, parts, sections, selection, and pages;
for the catalog with enablement. Edit through
engine.execute {command, params}
—
,
,
,
, table and comment commands. Positions are
{"story": "body" | {"part": n}, "path": [block, row, cell, …], "off": byteOffset}
;
/
shapes are documented in upstream
. UI commands such as
,
,
,
, and
drive chrome; dialogs and protection still apply to input.
Input methods (
,
with 0-based page and page-point coordinates,
/
,
,
,
) go to the active window's focused widget and reply
when queued, not when applied — inspect the resulting state before dependent edits and never replay an edit just because its effect was not immediate.
Verify with
ui.render {page?, scale?, doc?}
(engine-rendered page PNG, no window needed) or
(window state, dialogs, balloons). Report saved and exported paths and material warnings.
Printing and export
Native printing:
inspects and configures the printer (
starts discovery; set
,
,
,
), and
submits the print-ready PDF without a dialog, accepting
,
,
,
,
, and
(Scale to Paper Size; the document's page size is unchanged). Poll
until
is false and check
/
.
exports PDF; invalid ranges submit no job.