主题
UI Authoring MCP
Use this skill when the user wants help with the UI editor itself: inspect a GameUI hierarchy, find or select a control in UI Authoring, verify the Workbench lifecycle, compare Edit and Interact behavior, or smoke-test a UI editing workflow through AI automation.
Requirements
- Use the full SCE Editor MCP connected to an open project.
TriggerMcpHostand standalone Runtime MCP are not enough. - Start from
editor_get_contextand confirm the editor has an open project and reports the expected installed editor root, such asE:/WasmSCE/version-2000/SCE. - Treat
uiauthoring_*as editor automation tools, not project runtime APIs. They run a real Play In Editor UI Authoring session and operate the editor's Workbench/native authoring route. - Treat
uiauthoring_startas the normal fresh-runtime entry. It must use the product UI Authoring launch route that saves/generates project data and compiles/copies the client runtime before opening UI Authoring PIE. - Use
uiauthoring_start_no_compileonly as an explicit fast reopen when the current generated data andui/AppBundle/managedruntime are already known fresh. Do not use it for Save -> stop -> fresh PIE persistence evidence. - Do not use these tools to replace ordinary game runtime validation. For running gameplay UI outside UI Authoring, use
debug-tools/runtime_call_tool.
Standard Workflow
- Confirm MCP readiness:
json
{ "tool": "editor_get_context", "arguments": {} }If the AI client does not expose MCP tools directly but the editor is already listening on HTTP, use the project helper instead of writing a one-off JSON-RPC client:
powershell
.\ai\tools\Invoke-SceEditorMcp.ps1 -Context -Pretty
.\ai\tools\Invoke-SceEditorMcp.ps1 -ListTools -ToolPrefix uiauthoring_ -PrettyThe helper requires full Editor MCP by default and fails with service_identity if the port is TriggerMcpHost.
- Start UI Authoring PIE and wait for a real session. For validation that depends on saved data reaching runtime, use the compiled entry and allow enough time for generation/build/copy:
json
{ "tool": "uiauthoring_start", "arguments": { "timeout_ms": 300000 } }
{ "tool": "uiauthoring_wait", "arguments": { "operation_id": "<operation_id>", "timeout_ms": 20000 } }For a fast reopen when generated/runtime outputs are already known fresh:
json
{ "tool": "uiauthoring_start_no_compile", "arguments": { "timeout_ms": 90000 } }
{ "tool": "uiauthoring_wait", "arguments": { "operation_id": "<operation_id>", "timeout_ms": 20000 } }For an HTTP transport with a 30-second request limit, keep each wait below that limit and repeat with the same operation_id until terminal. The start timeout is the operation budget, not the duration to block one HTTP request.
If startup fails, read uiauthoring_status/uiauthoring_wait before reopening. Updated Editor and scripts retain the actual failure phase (for example generating_code), plus an optional build object containing build_id, diagnostic_summary, log_path/log_paths and result_path. Use that exact build_id with build_status/build_diagnostics for full errors; the summary is bounded to the first three errors. Generation exceptions also persist in generating_code-failure.log, and the UIAuthoring info-list source retains the failure. Fix the failing source or generation step before retrying the compiled entry; no-compile is not evidence that a failed generation was repaired. Older deployments may omit build, so report the available diagnostics rather than inventing an ID.
- Read structured state:
json
{ "tool": "uiauthoring_get_state", "arguments": { "include_hierarchy_flat": true } }Use native.hierarchy_flat to find source-backed and runtime-only controls without depending on the visible Workbench tree expansion state.
- Open the Workbench only when you need its host snapshot or visible UI:
json
{ "tool": "uiauthoring_open_workbench", "arguments": { "timeout_ms": 15000 } }- Select controls through stable structured selectors where possible:
json
{ "tool": "uiauthoring_select", "arguments": { "selector": { "source_entry_id": "<DataEntry.Id>" } } }Preferred selector order:
source_entry_idwhen it uniquely identifies a live control.source_definition_hashplusoccurrence_indexordisambiguation_handlewhen one source definition has multiple live instances.handle/runtime_handlefor one generation-scoped live occurrence.
If selection returns an ambiguity result, report the candidates instead of choosing silently.
- Switch mode or refresh as needed:
json
{ "tool": "uiauthoring_set_mode", "arguments": { "mode": "Interact" } }
{ "tool": "uiauthoring_set_mode", "arguments": { "mode": "Edit" } }
{ "tool": "uiauthoring_refresh", "arguments": {} }In Edit mode, expect the input gate to block business clicks. In Interact mode, expect the gate to be disabled so real GameUI input can run.
- Validate editable-property and direct-canvas slices through both source and runtime state. For source-backed edits, compare the Workbench snapshot, native runtime projection, and DataManager source JSON after commit/Undo/Redo/Save. After Save that must survive a fresh session, stop UI Authoring and restart with
uiauthoring_start, notuiauthoring_start_no_compile.
Current MCP tooling can start/select/read/refresh/mode-switch/stop UI Authoring, but it does not expose a first-class pointer-drag command. For drag/resize slices, have the user perform the pointer gesture manually, then use MCP state/readback to record final coordinates, Undo, Redo, Save, and fresh-runtime evidence. Esc/cancel validation should prove the preview reverted to the source value and did not dirty or save data.
For DataManager MCP writes, inspect the tool schema and use exact argument names. Prefer data_set_field for one path. If using data_set_fields, pass fields as a JSON object map; an array will throw a JsonObject type error.
- Close and clean up through product paths:
json
{ "tool": "uiauthoring_close_workbench", "arguments": { "timeout_ms": 15000 } }
{ "tool": "uiauthoring_stop", "arguments": { "timeout_ms": 20000 } }uiauthoring_close_workbench must use the real managed Workbench close path. After close, uiauthoring_get_state should still report native session state while the Workbench portion explicitly reports window/host/snapshot unavailable.
For a repeatable P0 check without hand-written JSON-RPC sequencing:
powershell
.\ai\tools\Invoke-SceEditorMcp.ps1 -Smoke UiauthoringP0 -PrettyEvidence To Report
For a UI Authoring automation run, report:
- editor executable root, update channel, project path, and SDK version from
editor_get_context; - whether all needed
uiauthoring_*tools are available; - which start path was used: compiled
uiauthoring_startor fastuiauthoring_start_no_compile, and why that path is valid for the claim; - session lifecycle evidence:
session_started, gameplay id, generation, and final invalid state after stop; - hierarchy node count, source-resolved count, and runtime-only count;
- the selected control's handle, type/name, source id/hash, and native result code;
- Workbench open/close host snapshot state;
- Edit/Interact mode and input-gate state.
- for editable properties or drag slices: before/after values from Workbench/native runtime/DataManager source, Undo/Redo results, Save dirty-state behavior, and fresh-runtime restart evidence when persistence is claimed;
- for manual gestures such as pointer drag or Esc cancel: the exact user-performed action, expected source/runtime value, observed value, and whether the Save button/dirty state changed.
Boundaries
- Current MCP automation covers lifecycle, state, selection, mode, refresh, Workbench open/close, and cleanup. It can validate C2/C3-style editing through structured state plus manual gesture evidence, but do not claim arbitrary property editing, drag/resize, save, reload, or template editing unless the installed editor exposes and verifies that slice.
- Do not treat a no-compile restart as fresh-runtime persistence evidence. A saved JSON file can still be stale in runtime until generated data and copied client assemblies are refreshed.
- Do not depend on rendered DOM text scraping or UIAutomation tree expansion as the primary contract. Prefer native state plus Workbench host snapshot.
- Always try
uiauthoring_stopafter a failed automation run if the session may have started.