Skip to main content

ui_inspect

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.registry.capability_adapter

Maturity: stable (support status; independent of enabled state, readiness and permissions).

Description​

Inspect the visual tree or diagnose UI Toolkit layout and text. Inspection may load assets or invoke user-defined callbacks.

Parameters​

NameTypeRequiredDescription
actionLiteral['ping', 'get_visual_tree', 'diagnose']yesFeature action to perform.
targetstr | None—Target GameObject name or path for attach_ui_document / get_visual_tree / render_ui.
component_typeLiteral['auto', 'ui_document', 'panel_renderer'] | None—UI component for attach/detach, get_visual_tree, modify_visual_element and render_ui. Default auto preserves an existing UIDocument, otherwise resolves PanelRenderer; new attachments prefer PanelRenderer when available and fall back to UIDocument. Explicit panel_renderer selection requires the Editor's native PanelRenderer API.
max_depthint | None—get_visual_tree / diagnose inclusive depth: root is 0; default 10, maximum 24.
max_nodesint | None—get_visual_tree / diagnose emitted node budget, including root (default 200).
max_evaluationsint | None—get_visual_tree operation budget: node admissions, child fetches and class probes; diagnose charges ancestors, admissions, child fetches, fixed style probes and pairs (default 5000). Not a time or scene-lookup bound.
max_charactersint | None—get_visual_tree / diagnose shared copied UTF-16 string budget including metadata (default 65536). get_visual_tree per-string limit 8192/class limit 64; diagnose name/type limit 256 and whole physical paths.
max_pairsint | None—diagnose physical sibling pairs examined before filters (default 2000); zero disables overlap and yields partial evidence.
max_findingsint | None—diagnose retained candidate findings (default 200); reaching the cap reports partial coverage.
unity_instancestr | 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​

Inspect a small UI Toolkit visual tree for the GameObject that owns a UIDocument. Replace HUD with that object's name or ID.

MCP arguments
{
"action": "get_visual_tree",
"target": "HUD",
"max_depth": 3,
"max_nodes": 30
}