Skip to main content
Glama

Assign Resource to Node Property

godot_assign_resource
Idempotent

Assign resources like textures, materials, or audio streams to node properties in Godot scenes. Specify node path, property name, and resource path to configure visual or audio elements.

Instructions

Loads a resource and assigns it to a property of a node. Useful for setting textures, materials, audio streams, etc.

Args:

  • node_path (string): Node path e.g. "/root/Main/Player/Sprite2D"

  • property (string): Property name e.g. "texture", "material", "stream"

  • resource_path (string): res:// path to the resource to assign

  • scene_path (string, optional): Scene to modify. Defaults to active scene.

Returns: Confirmation of the assignment.

Examples:

  • Use when: "Set the player sprite texture to res://assets/player.png" -> node_path: "/root/Main/Player/Sprite2D", property: "texture", resource_path: "res://assets/player.png"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
node_pathYesTarget node path
propertyYesProperty to set the resource on
resource_pathYesres:// path to the resource
scene_pathNoScene to modify. Omit for active scene.

Implementation Reference

  • The handler function that executes the godot_assign_resource tool logic. It makes a POST request to the Godot server at '/filesystem/assign-resource' with the node_path, property, resource_path, and optional scene_path, then returns a confirmation message.
    async ({ node_path, property, resource_path, scene_path }) => {
      await godotRequest<void>("POST", "/filesystem/assign-resource", {
        node_path, property, resource_path, scene_path
      });
      return {
        content: [{
          type: "text",
          text: `Assigned ${resource_path} to ${node_path}.${property}`
        }]
      };
    }
  • Tool registration for godot_assign_resource with title, description, input schema (using Zod for validation), and annotations defining it as idempotent and non-destructive.
      server.registerTool(
        "godot_assign_resource",
        {
          title: "Assign Resource to Node Property",
          description: `Loads a resource and assigns it to a property of a node. 
    Useful for setting textures, materials, audio streams, etc.
    
    Args:
      - node_path (string): Node path e.g. "/root/Main/Player/Sprite2D"
      - property (string): Property name e.g. "texture", "material", "stream"
      - resource_path (string): res:// path to the resource to assign
      - scene_path (string, optional): Scene to modify. Defaults to active scene.
    
    Returns:
      Confirmation of the assignment.
    
    Examples:
      - Use when: "Set the player sprite texture to res://assets/player.png"
        -> node_path: "/root/Main/Player/Sprite2D", property: "texture",
           resource_path: "res://assets/player.png"`,
          inputSchema: z.object({
            node_path: z.string().describe("Target node path"),
            property: z.string().describe("Property to set the resource on"),
            resource_path: z.string().describe("res:// path to the resource"),
            scene_path: z.string().optional().describe("Scene to modify. Omit for active scene.")
          }).strict(),
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
        },
  • Zod schema definition for input validation of the godot_assign_resource tool, validating node_path, property, resource_path (all required) and scene_path (optional).
    inputSchema: z.object({
      node_path: z.string().describe("Target node path"),
      property: z.string().describe("Property to set the resource on"),
      resource_path: z.string().describe("res:// path to the resource"),
      scene_path: z.string().optional().describe("Scene to modify. Omit for active scene.")
    }).strict(),
  • The godotRequest helper function that handles HTTP communication with the Godot server. It creates an axios client with proper headers and timeout, wraps requests with error handling, and validates the success response from the API.
    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;
      }
    }
Behavior4/5

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

The description adds valuable context beyond annotations: it explains what gets modified (node properties), mentions the optional scene_path parameter with default behavior, and describes the return value ('Confirmation of the assignment'). Annotations cover idempotency and safety, but the description provides practical implementation details that help the agent understand the tool's behavior.

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 well-structured and front-loaded with the core purpose, followed by organized sections (Args, Returns, Examples). Every sentence adds value: the first explains the tool's function, the second provides usage context, and subsequent sections offer practical guidance without redundancy.

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 mutation tool with no output schema, the description provides good coverage: it explains the tool's purpose, parameters, return value, and usage examples. The annotations cover safety aspects (idempotent, non-destructive), and the description adds practical implementation details. Minor gap: doesn't explicitly mention error conditions or what happens if the resource doesn't exist.

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

Parameters4/5

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

With 100% schema description coverage, the baseline is 3. The description adds meaningful context by explaining the purpose of each parameter in the Args section, providing concrete examples of property values ('texture', 'material', 'stream'), and clarifying the optional scene_path behavior ('Defaults to active scene'). This goes beyond the schema's basic descriptions.

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 tool's purpose with specific verbs ('Loads a resource and assigns it to a property of a node') and distinguishes it from siblings like 'godot_set_node_property' by focusing on resource assignment rather than general property setting. It provides concrete examples of use cases (textures, materials, audio streams).

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool ('Useful for setting textures, materials, audio streams, etc.') and provides a clear example scenario ('Set the player sprite texture to res://assets/player.png'). It distinguishes from siblings by focusing on resource assignment rather than general property setting or resource retrieval.

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