Opentoonz Run Script
opentoonz_run_scriptExecute custom OpenToonz JavaScript headlessly to automate scene, level, cell, and image operations when built-in MCP tools are insufficient.
Instructions
Run arbitrary OpenToonz JavaScript headlessly (the full-power escape hatch).
The script can use the OpenToonz API: new Scene(path?), scene.newLevel(type, name), scene.loadLevel(name, "path/..png"), scene.setCell(row, col, level, fid), scene.getCell(row, col), scene.getLevels(), scene.save(path), new Image(path), image.save(path), level.setFrame(fid, image). Use print() for output; stdout is returned. Do NOT use new Renderer() — renderFrame deadlocks in CLI mode; use opentoonz_render instead. Use absolute paths.
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": {
"workspace": "<workspace>",
"code": "<code>"
},
"name": "opentoonz_run_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout | No | ||
| workspace | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |