session_exec_python
Execute custom Python inside a Kratos session to access models, stages, and parameters, returning result or stdout when built-in tools are insufficient.
Instructions
Run Python inside the session's Kratos process for anything the
typed tools do not cover. The namespace holds KM (KratosMultiphysics),
model, stage (the AnalysisStage), session, parameters; assign a
JSON-serialisable value to result to get it back, and print() output
is returned as stdout. Example: result = model['Structure'].GetNode(75).X.
DISABLED unless the MCP server was started with KRATOS_MCP_ALLOW_EXEC=1, because it executes arbitrary code as the server's user.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| session_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||