ue_exec_transact
Run a Python snippet inside a single undoable Unreal Editor transaction, consolidating multiple edits into one undo step and rolling back all changes if the script fails.
Instructions
Run a Python snippet inside a named ScopedEditorTransaction.
Wraps the code in an Unreal transaction so that the entire operation appears as ONE undo step in the UE5 editor. If the code raises an exception, the transaction is cancelled and the editor state is rolled back to its pre-transaction position.
This is the PREFERRED way to run any mutating Unreal Python:
Blueprint modifications
Asset property changes
Component additions
Material edits
Your code should populate _result{}, _warnings[], _errors[] as needed (same contract as ue_exec_safe).
Args: code: Python snippet to execute inside the transaction transaction_name: Name shown in the UE5 Edit menu under Undo History
Returns: JSON string with StructuredResult.
KB: see knowledge_base/32_AGENT_PLAYABLE_SLICE_RECIPE.md#overview Example: ue_exec_transact(code="Example")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| transaction_name | No | MCP Operation |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |