Skip to main content
Glama
Show2Instruct

Bonsai MCP

execute_ifc_code

Destructive

Execute Python code to query, read, and write IFC entities and properties with IfcOpenShell/Bonsai APIs. Pre-injected namespace simplifies BIM data operations.

Instructions

[EDIT] PREFERRED code execution tool. Runs IfcOpenShell / Bonsai API code with a pre-injected IFC namespace. bpy access is BLOCKED; use execute_blender_code only when you genuinely need Blender operations (viewport, rendering, object transforms). Pre-injected variables: ifc (the loaded IFC file or None), ifcopenshell, ifc_api (ifcopenshell.api), element_util (ifcopenshell.util.element), tool (bonsai.tool). Pre-injected helper functions: get_ifc_file() (loaded IFC file or raises), get_default_container() (active spatial container), save_and_load_ifc(path=None) (save the project and reload it; call this after IFC edits to make them visible in the viewport, since edits do NOT appear until the project is reloaded). Use this for: querying IFC entities, reading/writing properties, traversing the IFC model, calling ifcopenshell.api operations, and any BIM data work.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython source using IfcOpenShell/Bonsai APIs. bpy imports are rejected.
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate destructiveHint: true; description adds that edits do not appear until project is reloaded and explains the save_and_load_ifc helper. Also states bpy imports are rejected, providing behavioral context beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with clear sections, front-loaded purpose, and informative bullet points. Slightly lengthy but justified by the complexity of the tool; every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a code execution tool with no output schema, the description is remarkably complete. It covers the tool's purpose, restrictions, available APIs, helper functions, and lifecycle considerations (reloading after edits). Leaves no significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers the single parameter 'code' with a basic description, but the tool description adds extensive semantics: lists pre-injected variables (ifc, ifcopenshell, etc.) and helper functions (get_ifc_file, get_default_container, save_and_load_ifc), which greatly aids the agent in crafting correct code.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it is a code execution tool for IfcOpenShell/Bonsai API with pre-injected IFC namespace. It distinguishes from sibling tool 'execute_blender_code' by noting bpy access is blocked and specifies its use for BIM data work.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly describes when to use this tool (for IFC queries, properties, traversing, API operations) and when not (for Blender operations, which require execute_blender_code). Provides guidance on calling save_and_load_ifc after edits.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Show2Instruct/bonsai-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server