Skip to main content
Glama

godot_validate_scene

Validate Godot scene files by dry-run loading to check for parsing errors before execution, ensuring scene integrity in development workflows.

Instructions

Dry-run load a saved scene resource and report whether Godot can parse it successfully, without running the 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.
godot_executableNoOptional explicit path to the Godot executable or .app bundle.

Implementation Reference

  • The implementation of the `godot_validate_scene` tool handler.
    def validate_scene(
        self,
        project_path: str,
        scene_path: str,
        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}")
    
        captured = _run_godot_script_with_capture(
            executable=executable,
            project_dir=project_dir,
            script_name="validate_scene.gd",
            user_args=["--scene-path", resource_scene_path],
        )
        if int(captured["returncode"]) != 0:
            details = "\n".join(
                part for part in [str(captured["stdout"]).strip(), str(captured["stderr"]).strip()] if part
            ).strip()
            raise GodotError(
                f"Godot helper script `validate_scene.gd` failed.\n"
                f"Log file: {captured['log_path']}\n"
                f"{details or 'No output was returned.'}"
            )
    
        parsed = _parse_script_json_output(str(captured["stdout"]), "validate_scene.gd")
        debug_output = _classify_debug_lines(
            str(captured["stdout"]),
            str(captured["stderr"]),
            str(captured["log_output"]),
        )
        filtered_errors = _filter_scene_validation_errors(
            debug_output["errors"],
            resource_scene_path,
            keep_fallback=not bool(parsed.get("valid", False)),
        )
    
        return {
            "project_path": str(project_dir),
            "scene_path": str(absolute_scene_path),
            "scene_resource_path": resource_scene_path,
            "valid": bool(parsed.get("valid", False)),
            "message": parsed.get("message"),
            "resource_type": parsed.get("resource_type"),
            "node_count": parsed.get("node_count"),
            "root_node_name": parsed.get("root_node_name"),
            "root_node_type": parsed.get("root_node_type"),
            "connection_count": parsed.get("connection_count"),
            "errors": filtered_errors,
            "warnings": debug_output["warnings"],
            "error_count": len(filtered_errors),
            "warning_count": debug_output["warning_count"],
            "log_path": captured["log_path"],
            "godot_executable": str(executable),
            "godot_version": version,
        }
  • Tool registration for `godot_validate_scene`.
        name="godot_validate_scene",
        description="Dry-run load a saved scene resource and report whether Godot can parse it successfully, without running the 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.",
                },
                "godot_executable": {
                    "type": "string",
                    "description": "Optional explicit path to the Godot executable or .app bundle.",
                },
            },
            "required": ["project_path", "scene_path"],
            "additionalProperties": False,
        },
        handler=lambda args: self.controller.validate_scene(
            project_path=args["project_path"],
            scene_path=args["scene_path"],
            godot_executable=args.get("godot_executable"),
        ),
    ),

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