cc_exec
Runs Lua code on a ComputerCraft computer and returns printed output, return values, and errors; variables persist between calls until reset, enabling iterative in-game scripting and debugging.
Instructions
Run Lua on the computer and return its output, return values and any error.
code may be an expression (os.getComputerID()) or statements. Variables persist between
calls until reset=True. Syntax errors, runtime errors (with traceback), printed text and
printError lines all come back. A script that never yields is aborted by CC after ~7 s.
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": {
"code": "<code>"
},
"name": "cc_exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| reset | No | ||
| timeout | No | ||
| computer | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |