Skip to main content
Glama

add_autoload

Register a new autoload by adding a script or scene to project.godot, singleton by default. Validate engine-stopping autoloads before headless runs; name or class_name conflicts fail.

Instructions

Register a new autoload. autoloadPath takes res://... or a project path. singleton defaults to true. No Godot process is used. An autoload that stops the engine before a headless operation is dispatched fails all of them: run validate on it first. Returns: autoload { name, path, singleton } read back from project.godot, and a tip. Errors if the name exists (use update_autoload), or a singleton shares its name with a class_name a project script declares (the engine then drops the script).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "projectPath": "<projectPath>",
      "autoloadName": "<autoloadName>",
      "autoloadPath": "<autoloadPath>"
    },
    "name": "add_autoload"
  }
}

Input Schema

NameRequiredDescriptionDefault
singletonNoRegister as a globally accessible singleton by name (default: true)
projectPathYesPath to the Godot project directory
autoloadNameYesName of the autoload node (e.g. "MyManager")
autoloadPathYesPath to the script or scene (e.g. "res://autoload/my_manager.gd" or "autoload/my_manager.gd")

Output Schema

NameRequiredDescriptionDefault
tipYes
autoloadYes
warningsNoPresent only when the scan for a class_name clash could not cover every .gd file, or the script extends a chain that could not be followed to its end, so a clash may remain.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv4.0.1
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "autoload": {
      +      "properties": {
      +        "name": {
      +          "type": "string"
      +        },
      +        "path": {
      +          "description": "res:// path of the script or scene.",
      +          "type": "string"
      +        },
      +        "singleton": {
      +          "type": "boolean"
      +        }
      +      },
      +      "required": [
      +        "name",
      +        "path",
      +        "singleton"
      +      ],
      +      "type": "object"
      +    },
      +    "tip": {
      +      "type": "string"
      +    },
      +    "warnings": {
      +      "description": "Present only when the scan for a class_name clash could not cover every .gd file, or the script extends a chain that could not be followed to its end, so a clash may remain.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "autoload",
      +    "tip"
      +  ],
      +  "type": "object"
      +}
  2. Addedv3.1.1
  3. Removedv3.0.0
  4. Addedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full behavioral burden and does so well: it names the persistence target (project.godot), two distinct failure modes including the non-obvious class_name collision that makes the engine drop the script, and the engine-stopping hazard that breaks subsequent headless operations. It stops short of stating whether the write to project.godot is atomic or reversible, which is the remaining meaningful gap for a mutation tool.

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?

Front-loaded with the action, then constraints, then returns, then errors — a sensible ordering with almost no filler. The final sentence compresses two unrelated error conditions into one dense clause, costing some scanability, but nothing is redundant.

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

Completeness5/5

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

Even though an output schema exists and returns need not be explained, the description still summarizes the payload and adds a behavioral warning the schema cannot express. For a three-required-parameter mutation with no annotations, the coverage of side effects, failure modes, and prerequisites is sufficient for correct invocation.

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 coverage is 100%, so the schema already documents all four parameters including the singleton default and the res:// versus relative path forms. The description's path-format and default notes largely restate the schema, adding only the passing context that the path may be a script or scene.

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?

States a specific verb and resource ("Register a new autoload") and immediately distinguishes itself from the sibling update tool by declaring that an existing name is an error and should be handled with update_autoload. An agent can identify both the action and its boundary without opening the schema.

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?

Gives explicit routing in both directions: existing names go to update_autoload, and risky engine-stopping autoloads must go through validate first. It also discloses that no Godot process is needed, which is a usage-relevant precondition for a headless workflow.

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