craftos_run
Run a workspace Lua program in a fresh CC:Tweaked emulator, attach monitors if needed, and return exit status, terminal and monitor output, and error details.
Instructions
Run a workspace program in a fresh emulated CC:Tweaked computer, optionally with monitors attached, and return its exit status (completed, program_failed, timed_out) plus the final text of the terminal and every monitor; a failed program also gets error {kind, message, file, line}. Set screenshots to also get PNG images. Pass snapshot to compare the screens against a golden file. timeoutMs covers copying the workspace too; a run that outlasts it comes back with status timed_out (normal for a program that waits for input forever). The computer gets a copy of the workspace (without .git, node_modules, .runtime and what .gitignore ignores); for a big workspace give world.deploy to copy only some folders.
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": {
"program": "<program>"
},
"name": "craftos_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | The program's arguments. | |
| scale | No | PNG pixels per screen pixel. | |
| world | No | The world around the computer (an object). Fields: addons, version, simProgram, craftosPcApis, motd, players, host, interacting, autoApprove, economyAvailable, holdInteraction, vhcctweaks, economyDelayTicks, gearPowerAvailable, identifyAvailable, internalErrors, vhccStore, linkLatency, computerId, kind, advanced, terminal, config, position, cobaltSpeed, label, deploy, peripherals, environment, entities, ap, mekanism, turtle, disks, blocks, fills, ground, items, gameRules, turtleConfig, spawnProtection, worldBorder, loadedChunks, unloadedChunks, nextDiskId, gameData, seed; e.g. {"peripherals":[{"name":"chest_0","type":"minecraft:chest","size":27}],"deploy":[{"from":"src"}]}. world.deploy picks which workspace folders or files go on the computer, and where ([{"from":"src","to":"lib"}]), instead of a copy of the whole workspace. Every field with its options: craftos_help {topic:"world"} (or the craftos://schema/world resource). Checked before boot: a wrong key or peripheral type comes back as an error with a suggestion. | |
| program | Yes | Workspace-relative path, e.g. "hello.lua" (as on the computer, so a deploy list's target path). | |
| monitors | No | Monitors attached before it starts. | |
| snapshot | No | Compare final screens with __snapshots__/<name>.json (created on first use). | |
| timeScale | No | Virtual clock speed. 10 makes sleep(), os.clock() and os.epoch() run 10x faster than real time, so slow scripts finish quickly. timeoutMs stays in real time. | |
| timeoutMs | No | Real time before the run stops as timed_out. | |
| worldFile | No | A saved world: a name in the worlds folder (e.g. "advanced-peripherals-demo") or a workspace path to a .json file (e.g. "door.world.json"). Fields in `world` override it. | |
| fullScreens | No | Keep every line, trailing blank ones too (default: lines stop at the last non-blank one). | |
| screenshots | No | Also return a PNG of every screen. |