MCP: Fix scene_action connect not persisting signal connections - #1367
Closed
MichaelFisher1997 wants to merge 1 commit into
Closed
MichaelFisher1997 wants to merge 1 commit into
MichaelFisher1997 wants to merge 1 commit into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Sep 1, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
scene_actiontool'sconnectaction reported success ("Connected signal…") but never persisted the connection: no[connection]entry was written to the.tscnfile (verified by grepping both existing and freshly created scenes). The connection existed only in memory for the running session, so AI agents wiring up signals got a misleading success message plus a generated callback stub while the actual wire-up silently vanished on save/reload.Root cause
MCPTools::tool_scene_action()connected signals with default flags:source->connect(sig, Callable(target, method));PackedScene::pack()→SceneState::_parse_connections()skips every connection withoutCONNECT_PERSIST(scene/resources/packed_scene.cpp:1086), so the packed scene dropped it. The editor's Connections dialog sets this flag (editor/scene/connections_dialog.cpp:950); the MCP tool did not.Fix
CONNECT_PERSISTwhen connecting (modules/mcp/mcp_tools.cpp).connect()'s return value and surface an error instead of a success message on failure.Verification
Ran the editor binary headless as an MCP server and drove it over stdio JSON-RPC:
initializehandshakescene_action create→ freshres://test.tscn(Node2D root)scene_action add→ Button childscene_action connect→pressed→on_pressedBefore:
.tscncontained no[connection]section.After: