get_scene_tree
Retrieve a scene's node hierarchy as a nested tree, scoped by depth or parent path. Use it to map nodes, node paths, and attached scripts before editing them.
Instructions
Get a scene's node hierarchy as a nested tree. maxDepth: 1 lists only direct children; the default -1 is the whole tree. parentPath scopes to one subtree. Returns: the root node { name, type, path, script, children[] }, every child the same shape; path is a root/... node path the node tools accept, script a res:// path or an empty string. A node cut by maxDepth has children null and a childCount, and warnings leads. Errors if the scene or parentPath is not found.
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": {
"projectPath": "<projectPath>",
"scenePath": "<scenePath>"
},
"name": "get_scene_tree"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxDepth | No | Maximum recursion depth. -1 for unlimited (default: -1). 1 returns only direct children. | |
| scenePath | Yes | Scene file path relative to the project | |
| parentPath | No | Scope to a subtree starting at this node path (e.g. "root/Player") | |
| projectPath | Yes | Path to the Godot project directory |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| path | Yes | Node path from the scene root in the "root/..." form the node tools accept. | |
| type | Yes | ||
| script | Yes | res:// path of the attached script, or "". | |
| children | Yes | Child nodes, each in this same shape. Null when maxDepth stopped the listing at a node that has children; childCount says how many. | |
| warnings | No | Root node only. Present when maxDepth cut the tree. | |
| childCount | No | Only when children is null: how many children were not listed. |