add_node
Insert a Godot node into a scene and save it automatically, validating property types and paths before adding. Returns the new node name and type or errors without changing the scene.
Instructions
Add a node to a Godot scene. Saves automatically. Common spatial properties (position, rotation, scale, visible, modulate) are top-level params; anything else goes under properties. {x,y} / {x,y,z} / {r,g,b,a} auto-convert to Vector2 / Vector3 / Color. Values are checked against the property's declared type and error instead of silently storing that type's zero value. Object-typed properties take a res:// path, a typed dict {type: ClassName, ...props} that constructs a Resource inline, or null. Full value rules: the Property Values section of docs/tools.md. parentNodePath defaults to the scene root. Returns a plain-text confirmation naming the new node and type. Errors, and adds nothing, if nodeType is not a registered Godot class, parentNodePath does not exist, or a property name or value is invalid. Errors while a Godot runtime session is active on this project; stop_project (or detach_project) clears it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scale | No | Vector2 scale (e.g. {"x": 2, "y": 2}) | |
| visible | No | Whether the node is visible | |
| modulate | No | Color modulation (e.g. {"r": 1, "g": 0, "b": 0, "a": 1}) | |
| nodeName | Yes | Name for the new node as it appears in the scene tree | |
| nodeType | Yes | Godot node class to instantiate (e.g. "Sprite2D", "CollisionShape2D", "Label"), or a project-relative scene path (.tscn or .scn, e.g. "scenes/enemy.tscn") to instance an existing scene as a child - instanced children serialize as `instance=ExtResource(...)` on save | |
| position | No | Position: {"x": 100, "y": 200} on a 2D node, {"x": 0, "y": 1, "z": 0} on a 3D node | |
| rotation | No | Rotation in radians | |
| scenePath | Yes | Scene file path relative to the project | |
| properties | No | Additional property values as a JSON object. Top-level params (position, rotation, etc.) take precedence over keys in this dict. | |
| projectPath | Yes | Path to the Godot project directory | |
| parentNodePath | No | Parent node path from scene root (e.g. "root/Player"). Defaults to the root node. |