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
| Name | Required | Description | Default |
|---|---|---|---|
| singleton | No | Register as a globally accessible singleton by name (default: true) | |
| projectPath | Yes | Path to the Godot project directory | |
| autoloadName | Yes | Name of the autoload node (e.g. "MyManager") | |
| autoloadPath | Yes | Path to the script or scene (e.g. "res://autoload/my_manager.gd" or "autoload/my_manager.gd") |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tip | Yes | ||
| autoload | Yes | ||
| warnings | No | 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. |