Skip to main content
Glama

native-full-hierarchy

Read-only

Retrieves the complete UIKit view tree of a running app for deep layout debugging, finding views without accessibility labels, and verifying UI structure beyond the accessibility tree.

Instructions

Get the complete UIKit view tree for the running app. WARNING: Output can be extremely large (100KB–500KB+) for complex apps, especially those built with SwiftUI. Prefer native-find-views for targeted queries. Reduce the output with skipClasses / skipClassPrefixes, fields and maxDepth. Use when you need deep layout debugging, finding views with no accessibility labels, or verifying view structure not exposed through the accessibility tree. Returns { status: "ok", windows, screen } with the full view hierarchy. screen gives the screen size in points, and the interfaceOrientation of the UI (portrait, portraitUpsideDown, landscapeLeft, landscapeRight). The size and each screenFrame use the axes of the UI as the user sees it, also when the UI is landscape: the space of screenshots and describe frames. Each windowFrame uses the axes of its window, which turn with the UI too. If status is restart_required: follow the message (usually restart-app), then retry. If status is service_stale: the app is already injected, so restarting it cannot help. Restart the tool-server (argent server stop && argent server start --detach) and retry. If the same status comes back after that restart, stop restarting: follow the message, which names the terminal fallback. If status is connect_pending: the app is injected and still connecting. Do not restart it, wait a few seconds and retry. If status is init_failed: follow the message (re-boot the simulator) rather than retrying. An Apple system app is rejected outright (terminal: never retry it).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "udid": "<udid>",
      "bundleId": "<bundleId>"
    },
    "name": "native-full-hierarchy"
  }
}

Input Schema

NameRequiredDescriptionDefault
udidYesSimulator UDID
fieldsNoView fields to include. Use EXACT names. Defaults: pointer, className, tag, frame, windowFrame, screenFrame, bounds, hidden, alpha, opaque, clipsToBounds, userInteractionEnabled, depth, identifier, label, layerName, nativeID. Additional: center, transform, contentMode, backgroundColor, tintColor, value, firstResponder
bundleIdYesBundle ID of the app
maxDepthNoMaximum recursion depth (default 8). Raise it to reach deeper views. Must be greater than 0.
skipClassesNoExact UIView class names whose entire subtree should be pruned (e.g. ["UIImageView"] to drop image leaf nodes)
skipClassPrefixesNoClass name prefixes to prune entire subtrees. For SwiftUI apps use ["_TtGC7SwiftUI"] to drop mangled SwiftUI generic type subtrees while keeping _UIHostingView and UIKit bridges. Avoid broad prefixes like "_UI": they prune useful system views.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / fields / description
      Previous value: -"View fields to include. Use EXACT names: className, frame, hidden, alpha, identifier, label, nativeID, userInteractionEnabled, depth, pointer, tag, windowFrame, screenFrame, bounds, center, opaque, clipsToBounds, transform, contentMode, backgroundColor, tintColor, layerName. Defaults to all of the first group when omitted."New value: +"View fields to include. Use EXACT names. Defaults: pointer, className, tag, frame, windowFrame, screenFrame, bounds, hidden, alpha, opaque, clipsToBounds, userInteractionEnabled, depth, identifier, label, layerName, nativeID. Additional: center, transform, contentMode, backgroundColor, tintColor, value, firstResponder"
    • changedInput schema / properties / maxDepth / description
      Previous value: -"Maximum recursion depth (default 8). Increase for deeper inspection, decrease to reduce output size."New value: +"Maximum recursion depth (default 8). Raise it to reach deeper views. Must be greater than 0."
    • removedInput schema / properties / maxDepth / maximum
      Removed value: -9007199254740991
    • changedInput schema / properties / skipClassPrefixes / description
      Previous value: -"Class name prefixes to prune entire subtrees. For SwiftUI apps use [\"_TtGC7SwiftUI\"] to drop mangled SwiftUI generic type subtrees while keeping _UIHostingView and UIKit bridges. Avoid broad prefixes like \"_UI\" — they prune useful system views."New value: +"Class name prefixes to prune entire subtrees. For SwiftUI apps use [\"_TtGC7SwiftUI\"] to drop mangled SwiftUI generic type subtrees while keeping _UIHostingView and UIKit bridges. Avoid broad prefixes like \"_UI\": they prune useful system views."
  2. Changed1 schema field changedv0.26.0
    • changedInput schema / properties / fields / description
      Previous value: -"View fields to include. Use EXACT names: className, frame, hidden, alpha, identifier, label, nativeID, userInteractionEnabled, depth, pointer, tag, windowFrame, bounds, center, opaque, clipsToBounds, transform, contentMode, backgroundColor, tintColor, layerName. Defaults to all of the first group when omitted."New value: +"View fields to include. Use EXACT names: className, frame, hidden, alpha, identifier, label, nativeID, userInteractionEnabled, depth, pointer, tag, windowFrame, screenFrame, bounds, center, opaque, clipsToBounds, transform, contentMode, backgroundColor, tintColor, layerName. Defaults to all of the first group when omitted."
  3. First observedv0.15.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only supply readOnlyHint=true, but the description discloses the dominant behavioral risk — output of 100KB–500KB+ on complex, especially SwiftUI, apps — and names mitigations. It further specifies the return payload shape (status/windows/screen) and, unusually, per-status recovery semantics (restart_required, service_stale, connect_pending, init_failed), including when restarting cannot help.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose and the size warning before the recovery matrix, and every paragraph is operational rather than filler. The status-handling block is dense and reads as a single wall of conditionals, which costs some scannability for an otherwise efficient definition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a bulky-output read tool with no output schema, the description supplies the return shape, screen-orientation frame semantics, size mitigation controls, and failure-state guidance. Nothing an agent needs to call it correctly or to recover from the documented statuses appears to be missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already carries the baseline, but the description adds meaning the schema cannot: it groups skipClasses / skipClassPrefixes / fields / maxDepth as output-reduction levers tied to the stated size risk. It does not restate field names or formats, which is appropriate, though it could say how aggressively to combine them.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Get the complete UIKit view tree for the running app,' and immediately contrasts scope with the sibling native-find-views for targeted queries. An agent can distinguish this tool from native-find-views and native-view-at-point without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use conditions (deep layout debugging, finding views with no accessibility labels, verifying structure not exposed through the accessibility tree) and an explicit when-not/alternative ('Prefer native-find-views for targeted queries'). It also names a hard exclusion: Apple system apps are rejected outright and must never be retried.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.