Skip to content

Prefab stages integration#1013

Merged
Scriptwonder merged 2 commits intoCoplayDev:betafrom
Scriptwonder:prefab-fix
Apr 1, 2026
Merged

Prefab stages integration#1013
Scriptwonder merged 2 commits intoCoplayDev:betafrom
Scriptwonder:prefab-fix

Conversation

@Scriptwonder
Copy link
Copy Markdown
Collaborator

@Scriptwonder Scriptwonder commented Mar 31, 2026

Moving Open/Close prefab stage from Manage_editor into Manage_prefab for better file discovery and management.

Summary by Sourcery

Route prefab stage editing through the manage_prefabs tool instead of manage_editor, and update APIs, CLI commands, and documentation to reflect the new workflow.

New Features:

  • Add open_prefab_stage, save_prefab_stage, and close_prefab_stage actions to the manage_prefabs tool for interactive prefab stage workflows.

Enhancements:

  • Clarify manage_prefabs and manage_editor tool descriptions to distinguish prefab asset operations from general editor control and direct users to the appropriate tool.
  • Update Unity and Python-side tests to cover prefab stage actions via manage_prefabs and remove obsolete manage_editor prefab stage tests.
  • Adjust CLI prefab commands and prefab-related API docs to use manage_prefabs for opening, saving, and closing prefab stages.
  • Rename and relocate prefab stage edit mode tests from ManageEditor to ManagePrefabs to match the new responsibilities.

Tests:

  • Add new server-side tests for manage_prefabs prefab stage actions and remove/manage_editor prefab stage tests to match the new API surface.

Summary by CodeRabbit

  • New Features

    • Prefab tool now supports interactive prefab-stage workflows (open/save/close).
  • Refactor

    • Prefab-stage commands moved from the general editor tool into the dedicated prefabs tool; editor tool no longer handles prefab-stage actions.
  • Documentation

    • Examples and docs updated to use the prefabs tool for prefab-stage operations.
  • Tests

    • Tests updated and added to validate prefab-stage behavior under the prefabs tool.

Copilot AI review requested due to automatic review settings March 31, 2026 16:24
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 31, 2026

Reviewer's Guide

Moves prefab stage open/save/close functionality from the generic editor tool into the prefab management tool, updates CLI/API/docs/tests to route prefab stage workflows through manage_prefabs instead of manage_editor, and extends ManagePrefabs to support interactive prefab stage workflows alongside headless editing.

Sequence diagram for prefab stage open/save/close via manage_prefabs

sequenceDiagram
    actor Developer
    participant CLI as prefab_CLI_commands
    participant Server as manage_prefabs_tool_python
    participant UnityInstance
    participant ManagePrefabsCS as ManagePrefabs_CSharp
    participant PrefabStageUtility
    participant EditorSceneManager
    participant StageUtility

    Developer->>CLI: prefab open-stage path
    CLI->>Server: manage_prefabs(action=open_prefab_stage, prefab_path)
    Server->>UnityInstance: async_send_command_with_retry(tool=manage_prefabs, params)
    UnityInstance->>ManagePrefabsCS: HandleCommand(params)
    ManagePrefabsCS->>ManagePrefabsCS: OpenPrefabStage(prefabPath)
    ManagePrefabsCS->>PrefabStageUtility: OpenPrefab(sanitizedPath)
    PrefabStageUtility-->>ManagePrefabsCS: PrefabStage(assetPath, prefabContentsRoot)
    ManagePrefabsCS-->>UnityInstance: SuccessResponse(prefabPath, rootName, enteredPrefabStage)
    UnityInstance-->>Server: result
    Server-->>CLI: result
    CLI-->>Developer: "Opened prefab stage" message

    Developer->>CLI: prefab save-stage
    CLI->>Server: manage_prefabs(action=save_prefab_stage)
    Server->>UnityInstance: async_send_command_with_retry(tool=manage_prefabs, params)
    UnityInstance->>ManagePrefabsCS: HandleCommand(params)
    ManagePrefabsCS->>ManagePrefabsCS: SavePrefabStage()
    ManagePrefabsCS->>PrefabStageUtility: GetCurrentPrefabStage()
    PrefabStageUtility-->>ManagePrefabsCS: PrefabStage(assetPath, scene)
    ManagePrefabsCS->>EditorSceneManager: MarkSceneDirty(scene)
    ManagePrefabsCS->>EditorSceneManager: SaveScene(scene)
    EditorSceneManager-->>ManagePrefabsCS: saved=true
    ManagePrefabsCS-->>UnityInstance: SuccessResponse(prefabPath, saved)
    UnityInstance-->>Server: result
    Server-->>CLI: result
    CLI-->>Developer: "Saved prefab stage" message

    Developer->>CLI: prefab close-stage --save
    CLI->>Server: manage_prefabs(action=close_prefab_stage, saveBeforeClose=true)
    Server->>UnityInstance: async_send_command_with_retry(tool=manage_prefabs, params)
    UnityInstance->>ManagePrefabsCS: HandleCommand(params)
    ManagePrefabsCS->>ManagePrefabsCS: ClosePrefabStage(saveBeforeClose=true)
    ManagePrefabsCS->>ManagePrefabsCS: SavePrefabStage()
    ManagePrefabsCS->>PrefabStageUtility: GetCurrentPrefabStage()
    PrefabStageUtility-->>ManagePrefabsCS: PrefabStage(assetPath, scene)
    ManagePrefabsCS->>EditorSceneManager: MarkSceneDirty(scene)
    ManagePrefabsCS->>EditorSceneManager: SaveScene(scene)
    EditorSceneManager-->>ManagePrefabsCS: saved=true
    ManagePrefabsCS->>StageUtility: GoToMainStage()
    StageUtility-->>ManagePrefabsCS: mainStageEntered
    ManagePrefabsCS-->>UnityInstance: SuccessResponse("Exited prefab stage", prefabPath)
    UnityInstance-->>Server: result
    Server-->>CLI: result
    CLI-->>Developer: "Prefab stage closed" message
Loading

Updated class diagram for ManagePrefabs prefab stage methods

classDiagram
    class ManagePrefabs {
        <<static>>
        +string ACTION_CREATE_FROM_GAMEOBJECT
        +string ACTION_GET_INFO
        +string ACTION_GET_HIERARCHY
        +string ACTION_MODIFY_CONTENTS
        +string ACTION_OPEN_PREFAB_STAGE
        +string ACTION_SAVE_PREFAB_STAGE
        +string ACTION_CLOSE_PREFAB_STAGE
        +string SupportedActions
        +object HandleCommand(JObject params)
        -object GetInfo(JObject params)
        -object GetHierarchy(JObject params)
        -object ModifyContents(JObject params)
        -object CreateFromGameObject(JObject params)
        -object OpenPrefabStage(string requestedPath)
        -object SavePrefabStage()
        -object ClosePrefabStage(bool saveBeforeClose)
    }

    class ErrorResponse {
        +string message
        +ErrorResponse(string message)
    }

    class SuccessResponse {
        +string message
        +object data
        +SuccessResponse(string message)
        +SuccessResponse(string message, object data)
    }

    class AssetPathUtility {
        +string SanitizeAssetPath(string requestedPath)
    }

    class AssetDatabase {
        +GameObject LoadAssetAtPath~GameObject~(string path)
    }

    class PrefabStageUtility {
        +PrefabStage OpenPrefab(string assetPath)
        +PrefabStage GetCurrentPrefabStage()
    }

    class PrefabStage {
        +string assetPath
        +GameObject prefabContentsRoot
        +Scene scene
    }

    class EditorSceneManager {
        +void MarkSceneDirty(Scene scene)
        +bool SaveScene(Scene scene)
    }

    class StageUtility {
        +void GoToMainStage()
    }

    class JObject
    class GameObject
    class Scene

    ManagePrefabs --> ErrorResponse : returns_on_failure
    ManagePrefabs --> SuccessResponse : returns_on_success
    ManagePrefabs --> AssetPathUtility : uses_for_path_sanitization
    ManagePrefabs --> AssetDatabase : loads_prefab_asset
    ManagePrefabs --> PrefabStageUtility : opens_and_queries_prefab_stage
    ManagePrefabs --> EditorSceneManager : saves_prefab_stage_scene
    ManagePrefabs --> StageUtility : exits_prefab_stage
    PrefabStageUtility --> PrefabStage : returns
    PrefabStage --> GameObject : prefabContentsRoot
    PrefabStage --> Scene : scene
Loading

File-Level Changes

Change Details Files
Extend ManagePrefabs Unity editor tool with prefab stage open/save/close actions and implementation.
  • Updated tool summary and SupportedActions to include open_prefab_stage, save_prefab_stage, and close_prefab_stage.
  • Routed new actions in HandleCommand to dedicated OpenPrefabStage, SavePrefabStage, and ClosePrefabStage methods.
  • Implemented OpenPrefabStage with path sanitization, validation of Assets/.prefab constraints, prefab existence checks, and PrefabStageUtility.OpenPrefab invocation returning structured SuccessResponse/ErrorResponse.
  • Implemented SavePrefabStage using PrefabStageUtility.GetCurrentPrefabStage plus EditorSceneManager.MarkSceneDirty/SaveScene with detailed error handling.
  • Implemented ClosePrefabStage that optionally saves via SavePrefabStage, exits via StageUtility.GoToMainStage, and returns a SuccessResponse even when no prefab stage is active.
MCPForUnity/Editor/Tools/Prefabs/ManagePrefabs.cs
Remove prefab stage responsibilities from ManageEditor Unity editor tool and its Python wrapper, constraining it to generic editor controls.
  • Deleted open_prefab_stage/save_prefab_stage/close_prefab_stage cases and helper methods from ManageEditor HandleCommand and removed now-unused using directives.
  • Updated ManageEditor unknown-action error message to point prefab editing users to manage_prefabs.
  • Simplified manage_editor Python tool: pruned prefab-stage-related literals from the action union, removed prefab_path/path parameters and conflict checking, and stopped forwarding prefab path params.
  • Adjusted UNITY_FORWARDED_ACTIONS in manage_editor tests to no longer list prefab stage actions and removed now-obsolete tests that exercised prefab stage behavior through manage_editor.
MCPForUnity/Editor/Tools/ManageEditor.cs
Server/src/services/tools/manage_editor.py
Server/tests/test_manage_editor.py
Wire prefab stage workflow through manage_prefabs in server tools, CLI, resources, docs, and tests.
  • Extended manage_prefabs Python tool description and ACTION_REQUIRED_PARAMS to cover open_prefab_stage/save_prefab_stage/close_prefab_stage and document headless vs interactive workflows.
  • Allowed manage_prefabs action parameter to include the three new prefab stage actions.
  • Updated CLI prefab commands to use manage_prefabs with action=open_prefab_stage/save_prefab_stage/close_prefab_stage instead of legacy open_stage/close_stage and manage_editor for save.
  • Updated prefab resources and tools reference documentation to direct users to manage_prefabs for prefab stage transitions and sample calls.
  • Updated CLI characterization tests to expect the new action name open_prefab_stage when opening stages.
Server/src/services/tools/manage_prefabs.py
Server/src/cli/commands/prefab.py
Server/src/services/resources/prefab.py
unity-mcp-skill/references/tools-reference.md
Server/tests/test_cli_commands_characterization.py
Move prefab stage Unity edit-mode tests from ManageEditor to ManagePrefabs and align behavior with new API.
  • Renamed the prefab stage test class and temp directory to target ManagePrefabs instead of ManageEditor and updated all HandleCommand invocations accordingly.
  • Kept coverage for parameter validation, path alias precedence, stage opening, and closing behavior but routed through ManagePrefabs.
  • Removed obsolete .meta file associated with the old ManageEditor test asset.
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManagePrefabsStageTests.cs
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageEditorPrefabStageTests.cs.meta
Align in-editor messaging and error guidance with the new prefab stage ownership.
  • Updated ManageGameObject prefab-asset error message to reference manage_prefabs close_prefab_stage instead of manage_editor close_prefab_stage.
  • Adjusted prefab API docs workflow step to reference manage_prefabs for open/save/close prefab stage actions.
MCPForUnity/Editor/Tools/GameObjects/ManageGameObject.cs
Server/src/services/resources/prefab.py

Possibly linked issues

  • #unknown: PR updates manage_prefabs and related tooling so prefab stage actions match between client, server, and CLI, fixing mismatch

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c9c4700c-c4b8-4929-b002-9390691f07ba

📥 Commits

Reviewing files that changed from the base of the PR and between c41d365 and 8b913ed.

📒 Files selected for processing (2)
  • MCPForUnity/Editor/Tools/Prefabs/ManagePrefabs.cs
  • Server/src/services/resources/prefab.py

📝 Walkthrough

Walkthrough

Prefab-stage lifecycle actions (open/save/close) were removed from ManageEditor and moved into a dedicated ManagePrefabs tool; CLI, server tool definitions, Unity editor code, tests, and docs were updated to route and handle prefab-stage workflows via manage_prefabs.

Changes

Cohort / File(s) Summary
ManageEditor Removal
MCPForUnity/Editor/Tools/ManageEditor.cs, Server/src/services/tools/manage_editor.py
Removed prefab-stage action handling and related parameters; updated action literals and error messaging to direct prefab-stage operations to manage_prefabs.
ManagePrefabs Implementation
MCPForUnity/Editor/Tools/Prefabs/ManagePrefabs.cs, Server/src/services/tools/manage_prefabs.py
Added interactive prefab-stage actions (open_prefab_stage, save_prefab_stage, close_prefab_stage), parameter validation/forwarding, and stage lifecycle helpers; expanded tool docs and required params.
CLI & Server Routing
Server/src/cli/commands/prefab.py, Server/src/services/resources/prefab.py
Updated CLI and resource docs to call manage_prefabs and to use *_prefab_stage action names.
GameObject Error Msg
MCPForUnity/Editor/Tools/GameObjects/ManageGameObject.cs
Adjusted an error message to reference manage_prefabs for prefab-stage operations.
Tests — Migration & Additions
Server/tests/test_manage_editor.py, Server/tests/test_manage_prefabs.py, Server/tests/test_cli_commands_characterization.py, TestProjects/.../ManagePrefabsStageTests.cs, TestProjects/.../ManageEditorPrefabStageTests.cs.meta
Removed prefab-stage tests from manage_editor, added tests for manage_prefabs stage actions, updated CLI test expectations, renamed C# test class and removed a .meta file.
Docs
unity-mcp-skill/references/tools-reference.md
Replaced manage_editor examples for prefab-stage control with manage_prefabs calls.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI
  participant Server as Server
  participant Tool as ManagePrefabs Tool
  participant Editor as Unity Editor (MCPForUnity)

  CLI->>Server: run_command("manage_prefabs", {action:"open_prefab_stage", prefab_path})
  Server->>Tool: dispatch manage_prefabs action (prefab_path)
  Tool->>Editor: HandleCommand -> OpenPrefabStage(prefabPath)
  Editor->>Editor: PrefabStageUtility.OpenPrefab(prefab asset)
  Editor-->>Tool: response {success: true, metadata}
  Tool-->>Server: forward result
  Server-->>CLI: return result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hop, I hopped from Editor's glade,

Prefabs now have a proper trade,
Open, save, and gently close the stage,
Tools aligned upon the page,
The warren cheers — new workflow made.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.84% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description identifies the change type (feature/enhancement), provides a clear summary of what was moved and why, and lists specific improvements. However, it deviates from the template by using Sourcery-generated format instead of the prescribed structure with explicit 'Type of Change', 'Changes Made', 'Testing/Screenshots', and 'Documentation Updates' sections with checkboxes. Consider restructuring the description to follow the repository template more closely: explicitly state the type of change, organize changes made, include testing details, and use documentation update checkboxes to verify all docs were updated.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Prefab stages integration' accurately summarizes the main change: moving prefab stage functionality from manage_editor to manage_prefabs for better organization and file discovery.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves Unity Prefab Stage open/save/close actions from manage_editor into manage_prefabs to improve tool organization and discoverability.

Changes:

  • Added open_prefab_stage / save_prefab_stage / close_prefab_stage handling to the Unity-side manage_prefabs tool and removed them from manage_editor.
  • Updated server tooling + CLI to route prefab stage operations through manage_prefabs instead of manage_editor.
  • Updated documentation and tests to reflect the new tool/action routing.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
unity-mcp-skill/references/tools-reference.md Updates docs/examples to use manage_prefabs for prefab stage actions.
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManagePrefabsStageTests.cs Renames/updates Unity edit-mode tests to target ManagePrefabs prefab stage actions.
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageEditorPrefabStageTests.cs.meta Removes old Unity meta for the prior test script name (potential rename fallout).
Server/tests/test_manage_prefabs.py Adds server-side tests for prefab stage actions on manage_prefabs.
Server/tests/test_manage_editor.py Removes prefab stage actions from manage_editor forwarded-actions coverage.
Server/tests/test_cli_commands_characterization.py Updates CLI characterization expectation to open_prefab_stage.
Server/src/services/tools/manage_prefabs.py Documents/exposes prefab stage actions in tool description and allowed actions.
Server/src/services/tools/manage_editor.py Removes prefab stage actions/params from manage_editor API surface and docs.
Server/src/services/resources/prefab.py Updates prefab resource docs to reference manage_prefabs for stage transitions.
Server/src/cli/commands/prefab.py Routes prefab open/save/close CLI commands through manage_prefabs and renames actions.
MCPForUnity/Editor/Tools/Prefabs/ManagePrefabs.cs Implements prefab stage open/save/close actions (incl. optional save-before-close) in manage_prefabs.
MCPForUnity/Editor/Tools/ManageEditor.cs Removes prefab stage routing and related methods from manage_editor.
MCPForUnity/Editor/Tools/GameObjects/ManageGameObject.cs Updates guidance text to reference manage_prefabs (not manage_editor) for closing prefab stage.
Comments suppressed due to low confidence (2)

Server/src/services/tools/manage_prefabs.py:66

  • manage_prefabs doesn't currently expose the same optional inputs that the Unity-side tool supports for prefab stage workflows. In particular, the Unity command handler accepts a path alias for prefabPath, and close_prefab_stage supports saveBeforeClose, but this Python tool signature/mapping only allows prefab_path and never forwards saveBeforeClose. Consider adding path: str | None as a compatibility alias (and validating conflicts with prefab_path like the old manage_editor implementation did), plus an optional save_before_close: bool | None that maps to saveBeforeClose when action == "close_prefab_stage".
async def manage_prefabs(
    ctx: Context,
    action: Annotated[
        Literal[
            "create_from_gameobject",
            "get_info",
            "get_hierarchy",
            "modify_contents",
            "open_prefab_stage",
            "save_prefab_stage",
            "close_prefab_stage",
        ],
        "Prefab operation to perform.",
    ],
    prefab_path: Annotated[str, "Prefab asset path (e.g., Assets/Prefabs/MyPrefab.prefab)."] | None = None,
    target: Annotated[str, "Target GameObject: scene object for create_from_gameobject, or object within prefab for modify_contents (name or path like 'Parent/Child')."] | None = None,
    allow_overwrite: Annotated[bool, "Allow replacing existing prefab."] | None = None,
    search_inactive: Annotated[bool, "Include inactive GameObjects in search."] | None = None,
    unlink_if_instance: Annotated[bool, "Unlink from existing prefab before creating new one."] | None = None,

TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManagePrefabsStageTests.cs:16

  • This test script file appears to be missing its corresponding Unity .meta file (there is no ManagePrefabsStageTests.cs.meta in the directory, and the PR deletes the old ManageEditorPrefabStageTests.cs.meta). In Unity projects, .meta files should be committed for scripts to keep stable GUIDs and avoid reimport churn; consider renaming the existing .meta alongside the .cs rename (preserving the GUID) or adding the new .meta file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
if (string.IsNullOrWhiteSpace(requestedPath))
{
return new ErrorResponse("'prefabPath' parameter is required for open_prefab_stage.");
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenPrefabStage accepts both prefabPath and the path alias, but the validation error message only mentions 'prefabPath' parameter is required. This is misleading for callers using the alias; consider updating the message to mention both accepted parameter names.

Suggested change
return new ErrorResponse("'prefabPath' parameter is required for open_prefab_stage.");
return new ErrorResponse("Either 'prefabPath' or 'path' parameter is required for open_prefab_stage.");

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Server/src/services/resources/prefab.py`:
- Line 60: The resource payload text references stage lifecycle actions under
manage_prefabs but the related_tools field still lists manage_editor, causing
inconsistency; update the related_tools entries that refer to "manage_editor"
(the ones associated with the prefab stage guidance string "Use manage_prefabs
action=open_prefab_stage / save_prefab_stage / close_prefab_stage") to
"manage_prefabs" in the prefab resource definition (also fix the same mismatch
at the other occurrence around lines 83–85) so callers are guided to the correct
action owner.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 71131d7f-e046-4d05-87e5-33b142d647cd

📥 Commits

Reviewing files that changed from the base of the PR and between 8e3f721 and c41d365.

📒 Files selected for processing (13)
  • MCPForUnity/Editor/Tools/GameObjects/ManageGameObject.cs
  • MCPForUnity/Editor/Tools/ManageEditor.cs
  • MCPForUnity/Editor/Tools/Prefabs/ManagePrefabs.cs
  • Server/src/cli/commands/prefab.py
  • Server/src/services/resources/prefab.py
  • Server/src/services/tools/manage_editor.py
  • Server/src/services/tools/manage_prefabs.py
  • Server/tests/test_cli_commands_characterization.py
  • Server/tests/test_manage_editor.py
  • Server/tests/test_manage_prefabs.py
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageEditorPrefabStageTests.cs.meta
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManagePrefabsStageTests.cs
  • unity-mcp-skill/references/tools-reference.md
💤 Files with no reviewable changes (1)
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageEditorPrefabStageTests.cs.meta

"1. Use manage_asset action=search filterType=Prefab to find prefabs",
"2. Use the asset path to access detailed data via resources below",
"3. Use manage_editor action=open_prefab_stage / save_prefab_stage / close_prefab_stage for prefab editing UI transitions"
"3. Use manage_prefabs action=open_prefab_stage / save_prefab_stage / close_prefab_stage for prefab editing UI transitions"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix contradictory prefab tool guidance in this resource payload.

Line 60 correctly routes stage lifecycle to manage_prefabs, but related_tools still says manage_editor owns open/save/close stages. This inconsistency can send callers to unsupported actions.

Suggested doc fix
         "related_tools": {
-            "manage_editor": "Open/save/close prefab stages in the Unity Editor UI",
-            "manage_prefabs": "Headless prefab inspection and modification without opening prefab stages",
+            "manage_editor": "Editor controls (play/pause/stop, active tool, tags/layers, package deploy/restore)",
+            "manage_prefabs": "Prefab stage lifecycle (open/save/close) and headless prefab inspection/modification",
             "manage_asset": "Search for prefab assets, get asset info",
             "manage_gameobject": "Modify GameObjects in open prefab stage",
             "manage_components": "Add/remove/modify components on prefab GameObjects"
         }

Also applies to: 83-85

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Server/src/services/resources/prefab.py` at line 60, The resource payload
text references stage lifecycle actions under manage_prefabs but the
related_tools field still lists manage_editor, causing inconsistency; update the
related_tools entries that refer to "manage_editor" (the ones associated with
the prefab stage guidance string "Use manage_prefabs action=open_prefab_stage /
save_prefab_stage / close_prefab_stage") to "manage_prefabs" in the prefab
resource definition (also fix the same mismatch at the other occurrence around
lines 83–85) so callers are guided to the correct action owner.

@Scriptwonder Scriptwonder merged commit e4f5762 into CoplayDev:beta Apr 1, 2026
1 check passed
@Scriptwonder Scriptwonder deleted the prefab-fix branch April 1, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants