Skip to content

Node Manipulation

Add, remove, and modify nodes in a Godot scene.

Operations

node_add

Add a new node to a scene.

json
{
  "op": "node_add",
  "project_path": "/home/user/my-game",
  "scene": "scenes/level_01.tscn",
  "parent": "Level/Platforms",
  "name": "Platform_5",
  "class": "StaticBody3D"
}
ParameterTypeRequiredDescription
node_namestringrequiredName for the new node.
node_typestringrequiredThe Godot class name for the new node (e.g., "Sprite2D", "CollisionShape2D").
parent_pathstring 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_pathstringrequiredAbsolute path to the Godot project directory.
propertiesobject 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_pathstringrequiredPath to the scene file relative to the project root.

Response:

json
{
  "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.

json
{
  "op": "node_remove",
  "project_path": "/home/user/my-game",
  "scene": "scenes/level_01.tscn",
  "node": "Level/Platforms/Platform_Old"
}
ParameterTypeRequiredDescription
node_pathstringrequiredPath to the node to remove within the scene tree. All children of this node are also removed.
project_pathstringrequiredAbsolute path to the Godot project directory.
scene_pathstringrequiredPath to the scene file relative to the project root.

Response:

json
{
  "op": "node_remove",
  "node": "Level/Platforms/Platform_Old",
  "result": "ok"
}

node_set_properties

Set one or more properties on a node.

json
{
  "op": "node_set_properties",
  "project_path": "/home/user/my-game",
  "scene": "scenes/level_01.tscn",
  "node": "Level/Enemy_0",
  "properties": {
    "collision_layer": 2
  }
}
ParameterTypeRequiredDescription
node_pathstringrequiredPath to the target node within the scene tree (e.g., "Player/Sprite2D").
project_pathstringrequiredAbsolute path to the Godot project directory.
propertiesobjectrequiredProperties 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_pathstringrequiredPath to the scene file relative to the project root.

To set multiple properties at once, pass more keys in properties:

json
{
  "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:

json
{
  "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.

json
{
  "op": "node_reparent",
  "project_path": "/home/user/my-game",
  "scene": "scenes/level_01.tscn",
  "node": "Level/Pickups/Coin_0",
  "new_parent": "Level/Room2/Pickups"
}
ParameterTypeRequiredDescription
new_namestring optional
default: null
Rename the node during reparent. Useful to avoid name collisions.
new_parent_pathstringrequiredPath to the new parent node within the scene tree.
node_pathstringrequiredPath to the node to move within the scene tree.
project_pathstringrequiredAbsolute path to the Godot project directory.
scene_pathstringrequiredPath to the scene file relative to the project root.

Response:

json
{
  "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.

json
{
  "op": "node_find",
  "project_path": "/home/user/my-game",
  "scene": "scenes/level_01.tscn",
  "class": "CharacterBody3D",
  "group": "enemies",
  "name_pattern": "Enemy_*"
}
ParameterTypeRequiredDescription
class_namestring optional
default: null
Filter by Godot class name (supports inheritance via is_class()).
groupstring optional
default: null
Filter by group membership.
limitnumber optional
default: 100
Maximum number of results to return (default: 100).
name_patternstring optional
default: null
Filter by node name pattern (supports * and ? wildcards).
project_pathstringrequiredAbsolute path to the Godot project directory.
propertystring optional
default: null
Filter: property must exist on the node.
property_valueany optional
default: null
Filter: property must equal this value (requires `property` to also be set).
scene_pathstringrequiredPath to the scene file relative to the project root.

Response:

json
{
  "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.

json
{
  "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"]
}
ParameterTypeRequiredDescription
addstring[] optional
default: null
Groups to add the node to.
node_pathstringrequiredPath to the target node within the scene tree.
project_pathstringrequiredAbsolute path to the Godot project directory.
removestring[] optional
default: null
Groups to remove the node from.
scene_pathstringrequiredPath to the scene file relative to the project root.

node_set_script

Attach a GDScript to a node.

json
{
  "op": "node_set_script",
  "project_path": "/home/user/my-game",
  "scene": "scenes/level_01.tscn",
  "node": "Level/Enemy_0",
  "script": "scripts/enemy_ai.gd"
}
ParameterTypeRequiredDescription
node_pathstringrequiredPath to the target node within the scene tree.
project_pathstringrequiredAbsolute path to the Godot project directory.
scene_pathstringrequiredPath to the scene file relative to the project root.
script_pathstring 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.

json
{
  "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
  }
}
ParameterTypeRequiredDescription
metaobjectrequiredMetadata entries to set. Keys are metadata names, values are the data. Set a value to null to remove that metadata key.
node_pathstringrequiredPath to the target node within the scene tree.
project_pathstringrequiredAbsolute path to the Godot project directory.
scene_pathstringrequiredPath to the scene file relative to the project root.

Property types

Director maps JSON types to Godot property types automatically:

JSON typeGodot type
number (integer)int
number (float)float
booleanbool
stringString, 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)
objectDictionary
arrayArray

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

Add a BoxShape3D collision to the Platform_5 node. Make it 4m wide, 0.5m tall, 4m deep.
Done. CollisionShape3D added under Platform_5 with a BoxShape3D (4×0.5×4m).

Fixing collision layers on multiple nodes

Set collision_layer=2 and collision_mask=1 on Enemy_0, Enemy_1, and Enemy_2.
All three enemies updated. collision_layer=2, collision_mask=1 applied to Enemy_0, Enemy_1, and Enemy_2.

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.

Open source under the MIT License.