get_page_tree
Retrieve the hierarchical structure of a Figma file to locate frames, components, and nodes by name. Use this tool to understand file organization and obtain node IDs for automated operations without manual selection.
Instructions
Get the hierarchical node tree of the current Figma file, up to a configurable depth.
Prerequisites: Requires Figma bridge running and plugin connected.
Returns on success: Nested tree structure — top level is an array of page objects, each with { id, name, type: "PAGE", children: [] }. Children are frames, components, groups, and other nodes. Each node has { id, name, type, children? }. Node IDs from this tree can be passed directly to capture_screenshot or figma_execute.
Error behavior: Throws "Figma not connected" if no plugin is connected. Very high depth values may time out for large files.
Use this tool: at the start of a session to understand file structure and locate frames by name, to find node IDs without requiring manual selection in Figma, or to enumerate all pages before performing bulk operations. Use depth=1 to list pages only, depth=2 (default) to see top-level frames, depth=3+ to drill into component internals.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | Maximum tree depth to traverse (default 2). Depth 1 = pages only, depth 2 = pages + top-level frames, depth 3+ = deeper into component trees. Large files at depth 4+ may be slow. |