diana_execute
Run Python code in the live DianaIE session to automate DIANA workflows, persist state across calls, and return stdout, stderr, and expression results with traceback on errors.
Instructions
Run Python code inside the live DianaIE session (DianaIE's embedded Python 3.7, GUI thread).
DIANA script commands are globals and state persists across calls. Returns stdout, stderr and the repr of the final expression's value; a Python exception becomes a tool error with the traceback. Never call pause() or anything that opens a dialog (it blocks until the user closes it). newProject, openProject, importModel and closeProject discard unsaved changes. setParameter needs the path below the item's model directory (diana_parameters shows it) and returns False, changing nothing, for other forms.
Args: code: Python 3.7 source. Use absolute paths. timeout_seconds: how long to wait for DianaIE to finish; raise it for meshing or solver runs.
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": "diana_execute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||