Skip to main content
Glama

godot_add_node

Add a new node to an existing Godot scene by specifying the node type, scene path, and parent location within the project.

Instructions

Add a new node of any instantiable Godot node type to an existing saved scene.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath to the Godot project directory or its project.godot file.
scene_pathYesPath to the target .tscn file. Absolute, relative, and res:// paths are supported.
node_typeYesGodot node class to instantiate, such as Sprite2D, Timer, Control, or AudioStreamPlayer2D.
parent_pathNoScene-relative node path where the new node should be attached. Use '.' for the root..
node_nameNoOptional explicit node name. Defaults to the chosen node type.
godot_executableNoOptional explicit path to the Godot executable or .app bundle.

Implementation Reference

  • The implementation of the 'add_node' method in the GodotController class, which runs a helper script 'add_node.gd'.
    def add_node(
        self,
        project_path: str,
        scene_path: str,
        node_type: str,
        parent_path: str = ".",
        node_name: str | None = None,
        godot_executable: str | None = None,
    ) -> dict[str, Any]:
        project_dir = ensure_project_path(project_path)
        executable, version = resolve_godot_executable(godot_executable)
        absolute_scene_path, resource_scene_path = resolve_scene_path(project_dir, scene_path)
    
        if not absolute_scene_path.exists():
            raise GodotError(f"Scene not found: {absolute_scene_path}")
    
        final_node_type = node_type.strip()
        if not final_node_type:
            raise GodotError("`node_type` is required.")
    
        final_node_name = (node_name or "").strip() or final_node_type
        normalized_parent_path = normalize_scene_node_path(parent_path)
    
        output = _run_godot_script(
            executable=executable,
            project_dir=project_dir,
            script_name="add_node.gd",
            user_args=[
                "--scene-path",
                resource_scene_path,
                "--parent-path",
                normalized_parent_path,
                "--node-type",
                final_node_type,
                "--node-name",
                final_node_name,
            ],
        )
        parsed = _parse_script_json_output(output, "add_node.gd")
    
        return {
            "project_path": str(project_dir),
            "scene_path": str(absolute_scene_path),
            "scene_resource_path": resource_scene_path,
            "parent_path": parsed.get("parent_path", normalized_parent_path),
            "node_path": parsed.get("node_path"),
            "node_name": parsed.get("node_name", final_node_name),
            "node_type": parsed.get("node_type", final_node_type),
            "godot_executable": str(executable),
            "godot_version": version,
        }
  • The registration of the 'godot_add_node' tool within the GodotMcpServer class, mapping it to the controller method.
        name="godot_add_node",
        description="Add a new node of any instantiable Godot node type to an existing saved scene.",
        input_schema={
            "type": "object",
            "properties": {
                "project_path": {
                    "type": "string",
                    "description": "Path to the Godot project directory or its project.godot file.",
                },
                "scene_path": {
                    "type": "string",
                    "description": "Path to the target .tscn file. Absolute, relative, and res:// paths are supported.",
                },
                "node_type": {
                    "type": "string",
                    "description": "Godot node class to instantiate, such as Sprite2D, Timer, Control, or AudioStreamPlayer2D.",
                },
                "parent_path": {
                    "type": "string",
                    "description": "Scene-relative node path where the new node should be attached. Use '.' for the root.",
                    "default": ".",
                },
                "node_name": {
                    "type": "string",
                    "description": "Optional explicit node name. Defaults to the chosen node type.",
                },
                "godot_executable": {
                    "type": "string",
                    "description": "Optional explicit path to the Godot executable or .app bundle.",
                },
            },
            "required": ["project_path", "scene_path", "node_type"],
            "additionalProperties": False,
        },
        handler=lambda args: self.controller.add_node(
            project_path=args["project_path"],
            scene_path=args["scene_path"],
            node_type=args["node_type"],
            parent_path=args.get("parent_path", "."),
            node_name=args.get("node_name"),
            godot_executable=args.get("godot_executable"),
        ),
    ),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While it indicates this is a write operation ('Add'), it doesn't mention important behavioral traits like whether this requires specific permissions, if changes are saved immediately, potential side effects on scene structure, or error conditions. The description is minimal and lacks operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core purpose without unnecessary words. It's appropriately sized for the tool's complexity and gets straight to the point with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after node addition, potential return values, error conditions, or important behavioral constraints. Given the tool modifies scene files and has 6 parameters, more operational context would be needed for an agent to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameters are documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions. It mentions 'any instantiable Godot node type' which aligns with the node_type parameter but doesn't provide additional semantic context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Add a new node'), the resource type ('any instantiable Godot node type'), and the target location ('to an existing saved scene'). It distinguishes itself from siblings like godot_create_scene (creates new scenes) and godot_edit_scene (general scene editing).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'existing saved scene,' suggesting this tool is for modifying scenes rather than creating them. However, it doesn't explicitly state when to use this versus alternatives like godot_edit_scene or provide clear exclusions for when other tools would be more appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MhrnMhrn/godot-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server