Execute Python code
execute_codeRun Python code in a sandbox to interact with STAAD.Pro models—define load cases, extract data, and set properties via the pre-connected staad object.
Instructions
Execute Python code in a sandbox against the OpenSTAAD API (don't forget to call discover_api and read_skills for API guidance).
The sandbox provides pre-connected staad (the OpenSTAAD root object) and input_data (if input_data_path is provided) variables (plus json
and math modules). import statements, dir(), getattr(), ... are BLOCKED.
The last expression value or an explicit result = ... assignment is returned as the result.
If output_data_path is provided, the sandbox will write the result to the specified file.
Paths must be on the user LOCAL filesystem and inside MCP roots or configured allowed_dirs.
On Claude Desktop, users can configure allowed directories in the extension settings and Claude can use the filesystem copy_file_to_claude
tool to move files to Claude's filesystem.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python source code to execute. Use the pre-injected ``staad`` variable to interact with the API. (don't forget to call discover_api and read_skills for API guidance) | |
| instance | No | Alias (from ``list_instances``, e.g. ``staadPro1``) of the STAAD instance to target. If omitted, last opened instance is selected. | |
| overwrite | No | Allow overwriting an existing output file. | |
| input_data_path | No | Path on user LOCAL filesystem to a ``.csv`` or ``.xlsx`` file. Its content is injected as the immutable `input_data` variable inside the sandbox. Use this to feed large datasets (e.g. node loads, section properties) into your code without hardcoding them. | |
| output_data_path | No | Path on user LOCAL filesystem to a ``.csv`` or ``.xlsx`` file where to write the ``result`` value. Use this to avoid flooding the context window with large amount of data. The ``result`` variable must be formatted as one of: - List-of-lists → written as CSV or single-sheet xlsx: result = [["Node ID", "X", "Y", "Z"], [1, 0.0, 0.0, 0.0], ...] - Dict of sheet dicts → written as multi-sheet xlsx: result = { "Nodes": {"columns": ["Node ID", "X", "Y", "Z"], "rows": [[1, 0.0, 0.0, 0.0], ...]}, "Members": {"columns": ["Member ID", "Start", "End"], "rows": [[1, 1, 2], ...]} } |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||