typst_write_file
Create or overwrite text files in Typst projects, syncing Yjs CRDT updates via WebSocket and REST.
Instructions
Create or overwrite a text file (.typ, .bib, .toml, etc.) in a https://typst.app project, synchronizing the Yjs CRDT update via WebSocket (/editing/v3) and REST (/v1/files/:projectId/:fileId/yjs).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"projectId": "<projectId>",
"filePath": "<filePath>",
"content": "<content>"
},
"name": "typst_write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Full UTF-8 text content to write | |
| filePath | Yes | File path/name (e.g. 'main.typ') or file ID | |
| projectId | Yes | The Typst project ID | |
| preferWebSocket | No | Also push real-time TextUpdate over /editing/v3 WebSocket before REST persistence (default: true) |