Skip to main content
Glama

get_ui_tree

Retrieve the complete accessibility UI tree as structured JSON from iOS simulators for automation testing and interface analysis.

Instructions

Get the full accessibility/UI tree as structured JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidNoSimulator UDID (optional, defaults to booted simulator)

Implementation Reference

  • The handler function for the 'get_ui_tree' MCP tool, which resolves the target device UDID and fetches the UI tree.
    private async getUiTree(udid?: string) {
      const target = await resolveUdid(udid);
      try {
        const tree = await this.fetchUiTree(target);
        return {
          content: [{ type: 'text', text: JSON.stringify(tree, null, 2) }],
        };
      } catch (error: any) {
        throw new McpError(ErrorCode.InternalError, `Failed to get UI tree: ${error.message}`);
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xmuweili/app-screen-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server