主题
SCE Editor Project and Scene Lifecycle MCP
Use this skill for lifecycle operations in a full SCE Editor process. These tools manage the editor's current project and scene; they are not runtime game APIs and do not replace debug_*, Runtime MCP, or the standalone TriggerMcpHost.
Requirements
- Connect to the full Editor MCP and begin with
editor_get_context. - Reuse the same Editor process for the complete workflow. Do not launch a second editor just to switch projects or scenes.
- Before any dependent edit, wait for the returned operation to finish and verify
editor_get_context.ready_state. - Serialize lifecycle writes. If an operation is already running, wait for it instead of sending another write.
Ready states
editor_get_context.ready_state is the semantic readiness contract:
| State | Meaning |
|---|---|
editor_ready | Full editor is connected; no project is loaded. |
project_ready | Project and its C# DataManager/GameDataManager are loaded; no scene is open. |
scene_ready | Project, scene, DataManager, and GameDataManager are loaded and usable. |
project_loading | A project open/reload operation is running. |
scene_loading | A scene open/reload operation is running. |
busy | A create/delete or other lifecycle operation is running. |
The latest operation result is also retained in lifecycle.state as succeeded, failed, or cancelled; this does not replace the current semantic ready state.
Standard operation protocol
Lifecycle calls return an asynchronous operation_id:
text
editor_open_project / editor_reload_project / editor_open_scene /
editor_reload_scene / editor_create_scene / editor_delete_scene
-> editor_lifecycle_wait(operation_id)
-> editor_get_context()Use editor_lifecycle_status for polling or for inspecting a known operation. editor_lifecycle_wait accepts timeout_ms from 0 through 300000; use a bounded timeout and inspect the returned state, phase, message, and error fields. A wait timeout is not proof of failure: query status and context before deciding whether to retry.
Example:
json
{
"tool": "editor_open_scene",
"arguments": { "scene_path": "battle" }
}Then wait using the returned ID:
json
{
"tool": "editor_lifecycle_wait",
"arguments": { "operation_id": "<operation_id>", "timeout_ms": 300000 }
}Only treat an operation as successful when the wait/status payload reports state: "succeeded" and the follow-up context shows the expected project/scene and readiness.
Project operations
Open or switch project
json
{
"tool": "editor_open_project",
"arguments": {
"path": "C:/Users/<user>/Documents/SCE Projects/my_game",
"unsaved_strategy": "cancel"
}
}path must be an existing SCE project directory. unsaved_strategy is explicit and accepts only:
cancel: stop when the current editor has unsaved changes;save: save current editor changes before switching;discard: abandon current editor changes before switching.
If the target project fails to load or does not reach its required ready state, the editor attempts to restore the project that was active before the operation. Treat the operation as failed until context confirms the final project.
Reload current project
json
{
"tool": "editor_reload_project",
"arguments": { "unsaved_strategy": "save" }
}Reload requires an open project and follows the same unsaved-change policy. For operations that need a usable scene and generated data, require scene_ready after the reload.
Scene operations
scene_path is a single directory name under <project>/scene/. Use names such as battle; do not send an absolute path, .., ., a slash, or a nested directory path.
Open and reload
json
{ "tool": "editor_open_scene", "arguments": { "scene_path": "battle" } }
{ "tool": "editor_reload_scene", "arguments": {} }editor_open_scene requires the target directory to exist. After success, verify both the context scene path and ready_state: "scene_ready".
Create
Creation is an in-project blank scene workflow. First preview, then execute:
json
{ "tool": "editor_create_scene", "arguments": { "scene_path": "mcp_smoke", "preview": true } }
{ "tool": "editor_create_scene", "arguments": { "scene_path": "mcp_smoke" } }The operation succeeds only after the new scene is loaded and the DataManager scene index is updated. Creation may update in-memory editor state; use the relevant explicit save tool/API when the scene must be persisted to disk. Do not assume a successful create operation alone is a durable save.
Delete
Deletion is destructive and requires a two-step confirmation:
json
{ "tool": "editor_delete_scene", "arguments": { "scene_path": "mcp_smoke", "preview": true } }
{ "tool": "editor_delete_scene", "arguments": { "scene_path": "mcp_smoke", "confirm": true } }The preview response is the safety checkpoint. Read has_unsaved_changes and requires_confirmation before executing. The current scene and the default scene cannot be deleted. If the project is dirty, execution returns unsaved_changes; explicitly save or discard the project first, then repeat preview and confirmation.
The formal delete path also removes the scene's DataManager/MapGameMode entries, Terrain Authoring Projection, scene scripts, .sceneconfig, scene-tree and file-watch state. After waiting for success, verify both the editor indexes and the scene directory on disk.
Error handling
Do not blindly retry a lifecycle write. Use the error code and current context:
| Error code | Action |
|---|---|
editor_busy | Wait for the reported operation_id. |
project_not_found | Correct the project directory; do not invent a path. |
project_not_open / scene_not_open | Open the required project/scene first. |
scene_not_found / scene_already_exists | Re-list or inspect the project filesystem before retrying. |
invalid_scene_path | Send only a safe one-level scene directory name. |
scene_in_use | Open another scene before deleting the target. |
scene_protected | Never delete default. |
unsaved_changes | Resolve the dirty state with an explicit save or discard, then repeat the destructive operation's preview. |
operation_not_found | The ID is stale or from another editor process; query fresh context and start a new operation. |
If a project load fails, preserve the recovery result in the report: record the requested path, operation ID, error, and the project/scene reported by the post-failure context.
Recommended unattended workflow
For a disposable scene smoke test:
text
editor_get_context
-> editor_create_scene(preview=true)
-> editor_create_scene -> editor_lifecycle_wait
-> editor_get_context(scene_ready)
-> make Terrain/UI or DataManager edits
-> explicit save
-> editor_reload_scene -> editor_lifecycle_wait
-> editor_open_scene(existing_scene) -> editor_lifecycle_wait
-> editor_delete_scene(preview=true)
-> editor_delete_scene(confirm=true) -> editor_lifecycle_wait
-> verify indexes and disk are cleanWhen reporting evidence, include the editor process/context, operation IDs and terminal states, requested and final project/scene paths, ready state, dirty-state strategy, and post-delete filesystem/index checks. If a step requires a human decision—especially save versus discard—pause and ask the user rather than choosing silently.
HTTP helper fallback
When the AI client does not expose MCP tools directly but the full editor listens on HTTP, use the project helper to discover and call the same tools:
powershell
.\ai\tools\Invoke-SceEditorMcp.ps1 -Context -Pretty
.\ai\tools\Invoke-SceEditorMcp.ps1 -Tool editor_lifecycle_status -Pretty
.\ai\tools\Invoke-SceEditorMcp.ps1 -Tool editor_open_project -ArgumentsJson '{"path":"C:/path/to/project","unsaved_strategy":"cancel"}' -PrettyThe helper must connect to the full Editor MCP. A standalone TriggerMcpHost is not a substitute for these lifecycle tools.