[UE 5.8.3][Unreal MCP] BlueprintTools.set_pin_value does not mark Blueprint dirty, causing silent data loss

Summary

Unreal Engine 5.8.3’s experimental Unreal MCP tool BlueprintTools.set_pin_value successfully changes a Blueprint pin’s default value in memory but fails to mark the owning Blueprint/package as Dirty. As a result, the operation reports success while the modification is silently lost after saving and restarting the Editor.

The root cause was traced to UBlueprintGraphPinLibrary::SetPinValue, which calls Schema->TrySetDefaultValue(*NativePin, Value, false), explicitly disabling Blueprint modification tracking.

What Type of Bug are you experiencing?

AI

Steps to Reproduce

  1. Open Unreal Engine 5.8.3 with the experimental ModelContextProtocol, ToolsetRegistry, AllToolsets, and EditorToolset plugins enabled.
  2. Create a test Blueprint containing a ForLoop macro node with an unconnected LastIndex input pin.
  3. Save the Blueprint and confirm that it is not marked Dirty.
  4. Through Unreal MCP, call BlueprintTools.set_pin_value to change the LastIndex pin’s default value to 5.
  5. Read the pin value again. The returned value is 5.
  6. Check the Blueprint/package Dirty state. It remains unchanged.
  7. Attempt to save the Blueprint using the normal Editor save workflow.
  8. Close and restart Unreal Editor, then reopen the Blueprint and inspect LastIndex.

Expected Result

A successful BlueprintTools.set_pin_value operation should mark the owning Blueprint/package as modified (Dirty), allowing the updated pin default value to be saved and preserved after restarting Unreal Editor.

The operation should not report a successful persistent edit if the modified Blueprint is not scheduled for saving.

Observed Result

BlueprintTools.set_pin_value returns successfully, and the ForLoop.LastIndex value changes to 5 in memory.

However, the Blueprint/package is not marked Dirty. The normal save workflow does not persist the modification. After restarting Unreal Editor, the pin reverts to its original value.

The exact cause was identified in:

Engine/Source/Editor/BlueprintEditorLibrary/Private/BlueprintEditorLibrary/BlueprintGraphPin.cpp:74

Schema->TrySetDefaultValue(*NativePin, Value, false);

The third argument (bMarkAsModified = false) prevents UEdGraphSchema_K2::TrySetDefaultValue from invoking FBlueprintEditorUtils::MarkBlueprintAsModified(Blueprint).

Suggested minimal fix:

Schema->TrySetDefaultValue(*NativePin, Value, true);

This proposed fix has not yet been validated through an engine rebuild.

The existing automated test test_get_set_pin_value verifies immediate readback but does not verify Dirty state, saving, or persistence after reopening the Editor.

This bug can cause silent loss of Blueprint changes during AI-assisted development.

Affects Versions

5.8

Platform(s)

Windows