capture_ui_snapshot
Auto-generated from the Python tool registry. Do not hand-edit outside
<!-- examples:start --><!-- examples:end -->blocks — the generator (tools/generate_docs_reference.py) will overwrite them.
Group: ui · Module: services.tools.capture_ui_snapshot
Maturity: stable (support status; independent of enabled state, readiness and permissions).
Description
Capture a bounded complete semantic scene UI snapshot for ugui or uitoolkit. Returns stable hierarchy identities, text, active/render eligibility/interactable state, current bounds and renderer-cull evidence where available. Does not write files or change resolution/layout itself. Both frameworks can invoke project-defined callbacks; hosted requester and plugin credentials each require read, edit and run. Ambiguous identities, overflow and unavailable live UI trees fail. Actual occlusion, pixel visibility and event delivery are not proven. Default captures use schema version 2 with fixed typed control states. Recognized editable input contents and owned text renderers are omitted before text access; ordinary labels remain. Native inventory allocation/time is separate from managed processing bounds. Use matching updated plugin/server versions; legacy v1 is supported only for offline comparison. Optional identity_map associates current child paths with nonsecret caller item IDs in either framework, emitting schema version 3 comparison identities. Update associations after row rebinding/reorder; valid stale associations cannot be detected. Mapped IDs are not mutation handles. Omission preserves schema version 2 and semantic ambiguity refusal. For uitoolkit, optional component_type selects auto, ui_document or panel_renderer. Explicit selection emits the actual component kind in evidence; missing or unsupported components refuse without fallback. Omission retains legacy auto output. Snapshot IDs remain mutation handles only for the canonical auto root without identity_map.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
framework | Literal['ugui', 'uitoolkit'] | yes | |
target | str | int | yes | |
max_nodes | int | — | |
identity_map | list[UiIdentityAssignment] | — | Optional current-path to nonsecret item-ID map. At most max_nodes minus one entries and 65536 aggregate path/ID characters; duplicate paths/IDs refuse. Omit for semantic v2 capture; explicit null/empty refuse. Mapped v3 identities remain parent-scoped and require caller rebinding; they are not mutation handles. |
component_type | Literal['auto', 'ui_document', 'panel_renderer'] | — | UI Toolkit only. Omit for compatible auto capture; explicit auto/ui_document/panel_renderer requires native resolved-kind evidence. Explicit null and unavailable components refuse. Noncanonical component IDs are not mutation handles. |
unity_instance | str | int | None | — | Target Unity instance for this call: Name@hash or hash prefix; an integer selects only that exact port over stdio and is rejected over HTTP. Read mcpforunity://instances for available targets. Omit to use the legacy active selection or the sole available instance. |
Returns
A dict containing the Unity response. The exact shape depends on the action.
Examples
Capture a bounded semantic snapshot of a uGUI HUD under Canvas/HUD. Use the GameObject path or ID for your actual root. A scoped connection needs read, edit, and run because capture can invoke project callbacks.
{
"framework": "ugui",
"target": "Canvas/HUD",
"max_nodes": 50
}