Node Manipulation
Add, remove, and modify nodes in a Godot scene.
Operations
node_add
Add a new node to a scene.
{
"op": "node_add",
"project_path": "/home/user/my-game",
"scene": "scenes/level_01.tscn",
"parent": "Level/Platforms",
"name": "Platform_5",
"class": "StaticBody3D"
}| Parameter | Type | Required | Description |
|---|---|---|---|
node_name | string | required | Name for the new node. |
node_type | string | required | The Godot class name for the new node (e.g., "Sprite2D", "CollisionShape2D"). |
parent_path | string | optional default: "." | Path to the parent node within the scene tree (e.g., "." for root, "Player" for a child named Player). Default: root node ("."). |
project_path | string | required | Absolute path to the Godot project directory. |
properties | object | optional default: null | Optional initial properties to set on the node after creation. Keys are property names, values are JSON representations of the property values. Type conversion is handled automatically (e.g., {"x": 100, "y": 200} for Vector2). |
scene_path | string | required | Path to the scene file relative to the project root. |
Response:
{
"op": "node_add",
"name": "Platform_5",
"class": "StaticBody3D",
"path": "Level/Platforms/Platform_5",
"result": "ok"
}The path in the response is the full scene-relative path to the newly created node.
node_remove
Remove a node and all its children.
{
"op": "node_remove",
"project_path": "/home/user/my-game",
"scene": "scenes/level_01.tscn",
"node": "Level/Platforms/Platform_Old"
}| Parameter | Type | Required | Description |
|---|---|---|---|
node_path | string | required | Path to the node to remove within the scene tree. All children of this node are also removed. |
project_path | string | required | Absolute path to the Godot project directory. |
scene_path | string | required | Path to the scene file relative to the project root. |
Response:
{
"op": "node_remove",
"node": "Level/Platforms/Platform_Old",
"result": "ok"
}node_set_properties
Set one or more properties on a node.
{
"op": "node_set_properties",
"project_path": "/home/user/my-game",
"scene": "scenes/level_01.tscn",
"node": "Level/Enemy_0",
"properties": {
"collision_layer": 2
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
node_path | string | required | Path to the target node within the scene tree (e.g., "Player/Sprite2D"). |
project_path | string | required | Absolute path to the Godot project directory. |
properties | object | required | Properties to set. Keys are property names, values are JSON representations. Type conversion is automatic: Vector2 from {"x":1,"y":2}, Color from "#ff0000" or {"r":1,"g":0,"b":0}, NodePath from string, resources from "res://" paths. |
scene_path | string | required | Path to the scene file relative to the project root. |
To set multiple properties at once, pass more keys in properties:
{
"op": "node_set_properties",
"project_path": "/home/user/my-game",
"scene": "scenes/enemy.tscn",
"node": "Enemy",
"properties": {
"collision_layer": 2,
"collision_mask": 1,
"motion_mode": "grounded",
"floor_snap_length": 0.1
}
}Response:
{
"op": "node_set_properties",
"node": "Level/Enemy_0",
"properties_set": ["collision_layer"],
"result": "ok"
}node_reparent
Change a node's parent or rename it in place.
{
"op": "node_reparent",
"project_path": "/home/user/my-game",
"scene": "scenes/level_01.tscn",
"node": "Level/Pickups/Coin_0",
"new_parent": "Level/Room2/Pickups"
}| Parameter | Type | Required | Description |
|---|---|---|---|
new_name | string | optional default: null | Rename the node during reparent. Useful to avoid name collisions. |
new_parent_path | string | required | Path to the new parent node within the scene tree. |
node_path | string | required | Path to the node to move within the scene tree. |
project_path | string | required | Absolute path to the Godot project directory. |
scene_path | string | required | Path to the scene file relative to the project root. |
Response:
{
"op": "node_reparent",
"node": "Level/Pickups/Coin_0",
"new_path": "Level/Room2/Pickups/Coin_0",
"result": "ok"
}node_find
Search nodes by class, group, name pattern, or property value.
{
"op": "node_find",
"project_path": "/home/user/my-game",
"scene": "scenes/level_01.tscn",
"class": "CharacterBody3D",
"group": "enemies",
"name_pattern": "Enemy_*"
}| Parameter | Type | Required | Description |
|---|---|---|---|
class_name | string | optional default: null | Filter by Godot class name (supports inheritance via is_class()). |
group | string | optional default: null | Filter by group membership. |
limit | number | optional default: 100 | Maximum number of results to return (default: 100). |
name_pattern | string | optional default: null | Filter by node name pattern (supports * and ? wildcards). |
project_path | string | required | Absolute path to the Godot project directory. |
property | string | optional default: null | Filter: property must exist on the node. |
property_value | any | optional default: null | Filter: property must equal this value (requires `property` to also be set). |
scene_path | string | required | Path to the scene file relative to the project root. |
Response:
{
"op": "node_find",
"nodes": [
{ "name": "Enemy_0", "class": "CharacterBody3D", "path": "Level/Enemies/Enemy_0" },
{ "name": "Enemy_1", "class": "CharacterBody3D", "path": "Level/Enemies/Enemy_1" }
],
"result": "ok"
}node_set_groups
Add or remove a node from groups.
{
"op": "node_set_groups",
"project_path": "/home/user/my-game",
"scene": "scenes/level_01.tscn",
"node": "Level/Enemy_0",
"add": ["enemies", "patrol_units"],
"remove": ["idle"]
}| Parameter | Type | Required | Description |
|---|---|---|---|
add | string[] | optional default: null | Groups to add the node to. |
node_path | string | required | Path to the target node within the scene tree. |
project_path | string | required | Absolute path to the Godot project directory. |
remove | string[] | optional default: null | Groups to remove the node from. |
scene_path | string | required | Path to the scene file relative to the project root. |
node_set_script
Attach a GDScript to a node.
{
"op": "node_set_script",
"project_path": "/home/user/my-game",
"scene": "scenes/level_01.tscn",
"node": "Level/Enemy_0",
"script": "scripts/enemy_ai.gd"
}| Parameter | Type | Required | Description |
|---|---|---|---|
node_path | string | required | Path to the target node within the scene tree. |
project_path | string | required | Absolute path to the Godot project directory. |
scene_path | string | required | Path to the scene file relative to the project root. |
script_path | string | optional default: null | Path to the .gd script file (relative to project, e.g., "scripts/player.gd"). Omit or set to null to detach the current script. |
node_set_meta
Set metadata on a node.
{
"op": "node_set_meta",
"project_path": "/home/user/my-game",
"scene": "scenes/level_01.tscn",
"node": "Level/Enemy_0",
"meta": {
"spawn_group": "wave_1",
"difficulty": 2
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
meta | object | required | Metadata entries to set. Keys are metadata names, values are the data. Set a value to null to remove that metadata key. |
node_path | string | required | Path to the target node within the scene tree. |
project_path | string | required | Absolute path to the Godot project directory. |
scene_path | string | required | Path to the scene file relative to the project root. |
Property types
Director maps JSON types to Godot property types automatically:
| JSON type | Godot type |
|---|---|
number (integer) | int |
number (float) | float |
boolean | bool |
string | String, NodePath, StringName |
[x, y] (2-element array) | Vector2 |
[x, y, z] (3-element array) | Vector3 |
[x, y, z, w] (4-element array) | Vector4, Quaternion, Color |
[[r,g,b,a]] | Color (if property expects Color) |
object | Dictionary |
array | Array |
For ambiguous cases (e.g., a 4-element array that could be a Quaternion or Color), Director uses the property's declared type from Godot's class database to disambiguate.
Example conversations
Building a collision shape
Fixing collision layers on multiple nodes
Tips
Use node_set_properties for all property setting. Setting 5 properties with one call is faster than 5 separate calls — see Batch Operations.
Node paths are relative to the scene root. The root node itself is ".". A child named Player is "Player". A grandchild is "Player/Camera3D". Use scene_read to confirm paths.
node_remove is permanent. There is no undo within Director. If you are making destructive changes, use scene_diff or git to review before removing.
Position is a shortcut. The position parameter in node_add sets Node3D.position (local position). For global position, use node_set_properties with "properties": {"position": [...]} after adding.