inject_script_autoload
Registers an existing GDScript as a Godot global Autoload singleton by editing project.godot. Use a res:// path to add the script to the project's singleton list.
Instructions
Add a GDScript as a Godot global Autoload singleton by editing project.godot. The script must exist in the project and use a res:// path.
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>",
"singletonName": "<singletonName>",
"scriptPath": "<scriptPath>"
},
"name": "inject_script_autoload"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scriptPath | Yes | Existing script resource path such as res://scripts/game_state.gd. | |
| projectPath | Yes | Absolute path to a directory containing project.godot. | |
| singletonName | Yes | Global singleton name, for example GameState. | |
| replaceExisting | No | Allow changing an existing singleton with the same name. Defaults to false. |