starccm_run_macro
Run checked Java macros against an open STAR-CCM+ simulation through a batch client, with source safety checks, output capture, and timeout handling that leaves the server running.
Instructions
Runs a Java macro on the STAR-CCM+ server at localhost: through a batch client. The server, its GUI and the open simulation stay running; on timeout only the batch client is killed.
Before running, the source is checked against patterns. Refused: Java reflection, class loading, System.exit/getenv, Runtime and processes, network and script engines (a reflective read-only macro once crashed a parallel server when it reached unloaded 3D-CAD sketches). Refused unless allow_risky=True: 3D-CAD access, saveState, deleting or clearing objects and data, closing the simulation, running the solver, meshing, and writing files. These checks catch mistakes; they are not a sandbox, and a macro that runs has the user's full rights.
Good practice: call starccm_session_info first; verify every class and method with starccm_api_lookup;
write simple macros like the ones STAR-CCM+ records; print results with sim.println(...), and prefix
lines with 'MCP|' to get them back in tagged_lines.
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": {
"port": "<port>"
},
"name": "starccm_run_macro"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | Yes | Server port from starccm_session_list | |
| source | No | Full Java source of the macro: a public class extending StarMacro, with execute() | |
| max_chars | No | Characters of output to return from the end | |
| timeout_s | No | ||
| macro_path | No | Path of an existing .java macro (instead of source) | |
| allow_risky | No | Allow operations that save, delete, close, run the solver or touch 3D-CAD. Only after the user agreed to that specific action. | |
| expected_sim | No | Refuse to run unless this simulation name is the one open on the port (checked against the GUI window title) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |