add_variable
Add a top-level variable or property declaration to a GDScript file in Godot 4 projects, supporting type hints, default values, and editor visibility options.
Instructions
Add a top-level variable or property declaration to a GDScript file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Absolute path to the project directory | |
| scriptPath | Yes | Script path (res:// or relative to project) | |
| varName | Yes | Variable name (valid GDScript identifier) | |
| type | No | Optional type hint, e.g. "float", "String", "Node2D" | |
| defaultVal | No | Optional default value expression, e.g. "300.0" or "Vector2.ZERO" | |
| exported | No | If true, adds @export annotation (makes variable visible in the editor) |