Skip to main content
Glama

Create New Scene File

godot_create_scene

Create new Godot scene files with specified root node types for organizing game levels, UI screens, or 3D environments directly within the editor.

Instructions

Creates a new empty scene file (.tscn) with a specified root node type.

Args:

  • scene_path (string): res:// path for the new scene e.g. "res://levels/level2.tscn"

  • root_type (string): Godot class for the root node e.g. "Node2D", "Node3D", "Control", "CharacterBody2D"

  • root_name (string, optional): Name for the root node (defaults to the scene file stem)

  • open_in_editor (boolean, optional): Open the new scene in the editor (default: true)

Returns: { path, root_node, root_type } of the created scene.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scene_pathYesres:// destination path for the new .tscn
root_typeYesGodot class name for the root node
root_nameNoName for the root node
open_in_editorNoOpen in editor after creation

Implementation Reference

  • Main implementation of godot_create_scene tool - includes registration with schema definition and the handler function that creates a new scene file by calling the Godot API via godotRequest with POST /scenes/create
      server.registerTool(
        "godot_create_scene",
        {
          title: "Create New Scene File",
          description: `Creates a new empty scene file (.tscn) with a specified root node type.
    
    Args:
      - scene_path (string): res:// path for the new scene e.g. "res://levels/level2.tscn"
      - root_type (string): Godot class for the root node e.g. "Node2D", "Node3D", "Control", "CharacterBody2D"
      - root_name (string, optional): Name for the root node (defaults to the scene file stem)
      - open_in_editor (boolean, optional): Open the new scene in the editor (default: true)
    
    Returns:
      { path, root_node, root_type } of the created scene.`,
          inputSchema: z.object({
            scene_path: z.string().describe("res:// destination path for the new .tscn"),
            root_type: z.string().describe("Godot class name for the root node"),
            root_name: z.string().optional().describe("Name for the root node"),
            open_in_editor: z.boolean().default(true).describe("Open in editor after creation")
          }).strict(),
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
        },
        async ({ scene_path, root_type, root_name, open_in_editor }) => {
          const result = await godotRequest<{ path: string; root_node: string; root_type: string }>(
            "POST", "/scenes/create", { scene_path, root_type, root_name, open_in_editor }
          );
          return {
            content: [{ type: "text", text: `Scene created: ${JSON.stringify(result, null, 2)}` }]
          };
        }
      );
  • The godotRequest helper function used by the handler to make HTTP requests to the Godot MCP Bridge API endpoint /scenes/create
    export async function godotRequest<T>(
      method: "GET" | "POST" | "PUT" | "DELETE",
      path: string,
      body?: unknown
    ): Promise<T> {
      try {
        const response = await client.request<ApiResponse<T>>({
          method,
          url: path,
          data: body
        });
    
        const payload = response.data;
        if (!payload.success) {
          throw new Error(payload.error ?? "Godot returned an unsuccessful response.");
        }
        return payload.data as T;
      } catch (err) {
        if (axios.isAxiosError(err)) {
          const axErr = err as AxiosError<ApiResponse<unknown>>;
          if (axErr.code === "ECONNREFUSED") {
            throw new Error(
              `Cannot connect to Godot at ${GODOT_BASE_URL}. ` +
              `Make sure the MCP Bridge plugin is enabled and the project is running ` +
              `(Project > Tools > MCP Bridge > Start Server).`
            );
          }
          const serverMsg = axErr.response?.data?.error;
          throw new Error(serverMsg ?? axErr.message);
        }
        throw err;
      }
    }
  • Input schema definition using zod - validates scene_path (required), root_type (required), root_name (optional), and open_in_editor (optional, default: true)
    inputSchema: z.object({
      scene_path: z.string().describe("res:// destination path for the new .tscn"),
      root_type: z.string().describe("Godot class name for the root node"),
      root_name: z.string().optional().describe("Name for the root node"),
      open_in_editor: z.boolean().default(true).describe("Open in editor after creation")
    }).strict(),
  • Compiled JavaScript version of the godot_create_scene tool implementation with the same registration and handler logic
        server.registerTool("godot_create_scene", {
            title: "Create New Scene File",
            description: `Creates a new empty scene file (.tscn) with a specified root node type.
    
    Args:
      - scene_path (string): res:// path for the new scene e.g. "res://levels/level2.tscn"
      - root_type (string): Godot class for the root node e.g. "Node2D", "Node3D", "Control", "CharacterBody2D"
      - root_name (string, optional): Name for the root node (defaults to the scene file stem)
      - open_in_editor (boolean, optional): Open the new scene in the editor (default: true)
    
    Returns:
      { path, root_node, root_type } of the created scene.`,
            inputSchema: z.object({
                scene_path: z.string().describe("res:// destination path for the new .tscn"),
                root_type: z.string().describe("Godot class name for the root node"),
                root_name: z.string().optional().describe("Name for the root node"),
                open_in_editor: z.boolean().default(true).describe("Open in editor after creation")
            }).strict(),
            annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
        }, async ({ scene_path, root_type, root_name, open_in_editor }) => {
            const result = await godotRequest("POST", "/scenes/create", { scene_path, root_type, root_name, open_in_editor });
            return {
                content: [{ type: "text", text: `Scene created: ${JSON.stringify(result, null, 2)}` }]
            };
        });
  • src/index.ts:6-16 (registration)
    Top-level registration that imports and calls registerAssetTools(server) to register the godot_create_scene tool along with other asset management tools
    import { registerAssetTools } from "./tools/asset-tools.js";
    import { GODOT_BASE_URL } from "./constants.js";
    
    const server = new McpServer({
      name: "godot-mcp-server",
      version: "1.0.0"
    });
    
    registerSceneTools(server);
    registerScriptTools(server);
    registerAssetTools(server);
Behavior3/5

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

Annotations already declare readOnlyHint=false, destructiveHint=false, etc., so the agent knows this is a non-destructive write operation. The description adds useful context about the file format ('.tscn'), the optional 'open_in_editor' behavior, and the return structure, which goes beyond annotations. However, it doesn't mention potential errors (e.g., invalid paths, unsupported root types) or side effects.

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

Conciseness4/5

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

The description is well-structured with a clear purpose statement followed by parameter and return sections. It's appropriately sized for a 4-parameter tool. However, the 'Args' section somewhat duplicates schema information, and the purpose statement could be slightly more front-loaded without the parameter details inline.

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

Completeness4/5

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

For a creation tool with full parameter documentation in the schema and annotations covering safety profile, the description provides adequate context. It explains the file format, includes examples, describes the return structure, and mentions the editor-opening behavior. The main gap is lack of error handling information, but overall it's reasonably complete.

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 the schema already fully documents all parameters. The description repeats parameter information in the 'Args' section but doesn't add meaningful semantic context beyond what's in the schema (e.g., explaining what 'res://' paths mean, providing examples of valid root types beyond the examples given). Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Creates a new empty scene file') with the resource type ('.tscn file') and key constraint ('with a specified root node type'). It distinguishes from siblings like 'godot_instantiate_scene' (which loads existing scenes) and 'godot_save_scene' (which saves modified scenes).

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

Usage Guidelines4/5

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

The description implies usage context through the parameter descriptions (e.g., 'res:// path', 'Godot class for the root node'), but doesn't explicitly state when to use this tool versus alternatives like 'godot_instantiate_scene' for loading existing scenes or 'godot_add_node' for adding nodes to existing scenes. The guidance is clear but lacks explicit sibling differentiation.

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/ricky-yosh/godot-mcp-server'

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