modo_run_python
Run Python inside Modo to automate scene edits, inspect geometry, and execute commands; preloaded helpers and current scene access let you query or modify the active scene.
Instructions
Run Python inside Modo. 'lx', 'lxu', 'modo' and 'scene' (the current scene) are preloaded. The value of a trailing expression, or of a variable named RESULT, is returned. Runs on Modo's own Python (3.10 on Modo 17.1, 3.9 on Modo 16); code is checked against that version first. 'mcp' holds workarounds for Modo bugs: mcp.vmaps(item) lists vertex maps where geometry.vmaps fails on 17.1. Keep each call under about 50 s (timeout_ms is capped at 55000): the client gives up after about 60 s while Modo keeps working, so split long builds into steps and never re-run a call that timed out without checking the scene first. Prefer this over long chains of single commands. Code using a command known to crash Modo is refused until repeated with acknowledge_risk=true. Always fill 'purpose' with one plain sentence about the effect: the user reads it, not the code, when deciding whether to approve.
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": {
"purpose": "<purpose>",
"code": "<code>"
},
"name": "modo_run_python"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| purpose | Yes | One short sentence, in the language of the conversation, saying what this does -- for example 'Creates three cubes joined by a bar'. Shown to the user before they approve the call, and in Modo's event log, so describe the effect, not the code. | |
| instance | No | This chat's Modo instance token (modo-xxxxxx) from modo_use_instance or modo_launch_instance. Pass it on every call once you have one; leave empty only while a single chat works with Modo. | |
| timeout_ms | No | ||
| acknowledge_risk | No | ||
| rollback_on_error | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |