Skip to main content

Description

Returns a hierarchical tree structure of instances starting from a specified path (or the root game object). This is useful for exploring the structure of your game and understanding parent-child relationships. The tree can be controlled with depth and node limits to avoid overwhelming results.

HTTP Endpoint

POST /tool/get_file_tree

Request Parameters

path
string
The starting path for the tree. Defaults to game (root). Examples: "Workspace", "ReplicatedStorage.Items"
depth
number
default:"3"
Maximum depth to traverse (capped at 3). Higher depth shows more nested levels.
limit
number
default:"200"
Maximum number of nodes to return (prevents huge results)

Response Format

name
string
Name of the root instance
className
string
Class name of the root instance
childCount
number
Number of immediate children
children
array
Array of child instances (recursive structure with same fields)
truncated
boolean
True if the result was truncated due to node limit
note
string
Additional information about truncation
error
string
Error message if path resolution failed

Example

const response = await fetch('http://127.0.0.1:7766/tool/get_file_tree', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    path: 'ReplicatedStorage',
    depth: 2,
    limit: 100
  })
});

const data = await response.json();
console.log(data.result);

// Example output:
// {
//   "name": "ReplicatedStorage",
//   "className": "ReplicatedStorage",
//   "childCount": 3,
//   "children": [
//     {
//       "name": "Items",
//       "className": "Folder",
//       "childCount": 5,
//       "children": [
//         {
//           "name": "Sword",
//           "className": "Tool",
//           "childCount": 2
//         }
//       ]
//     },
//     {
//       "name": "Modules",
//       "className": "Folder",
//       "childCount": 8
//     }
//   ]
// }

Implementation Details

From InstanceTools.lua:75-91:
  • Uses PathResolver.resolve() to find the starting instance
  • Recursively builds tree structure with instanceToTable()
  • Enforces depth limit (max 3)
  • Enforces node limit to prevent overwhelming results
  • Returns truncation notice when limits are reached

Build docs developers (and LLMs) love