The "tool" keyword was removed in Godot 4: use @tool
Put @tool on the first line instead of tool. In Godot 4 a script that runs in the editor starts with @tool, and the check for the editor is the method Engine.is_editor_hint(), no longer the property Engine.editor_hint.
AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.
Intel or AMD Chromebook, with Linux turned on.
What Godot is checking
GDScript 2.0 turned tool, export and onready into annotations. The parser recognises the old tool keyword so it can name the replacement, and stops: the script does not load.
@tool makes the script run inside the editor as well as in the game. Code that should run only in one of them checks Engine.is_editor_hint(), which the fixed run prints: false, because it ran as a game.
More on this: "yield" was removed in Godot 4. Use "await" instead: how to wait
Reproduce it
A Godot 3 tool script in a Godot 4 project. The scene is one Node with this script.
More on this: Signal '…' is already connected to given callable '…' in that object in Godot 4
tool
extends Node
func _ready():
print(Engine.editor_hint)
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
SCRIPT ERROR: Parse Error: The "tool" keyword was removed in Godot 4. Use the "@tool" annotation instead.
at: GDScript::reload (res://answers/tool-keyword-removed-in-godot-4/repro.gd:1)
ERROR: Failed to load script "res://answers/tool-keyword-removed-in-godot-4/repro.gd" with error "Parse error".
at: load (modules/gdscript/gdscript_resource_format.cpp:46)Fix it
The annotation on the first line, and the editor check as a method call.
@tool
extends Node
func _ready() -> void:
print("running in the editor: ", Engine.is_editor_hint())
What the fixed script prints
More on this: Preload file "…" does not exist in Godot 4
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
running in the editor: falseRun this fix with your agent
Flockbay is the Godot editor with an AI agent built in. Paste this into Flockbay's chat, or into Claude Code or Codex connected to Flockbay over MCP: the agent finds the cause in your project, applies the fix, runs the game headless and reads Godot's output to check it.
More on this: Assertion failed in Godot 4
My Godot project was written for Godot 3 and Godot 4 stops on this: "Parse Error: The "tool" keyword was removed in Godot 4. Use the "@tool" annotation instead.". Port every use to Godot 4. Put @tool on the first line instead of tool. In Godot 4 a script that runs in the editor starts with @tool, and the check for the editor is the method Engine.is_editor_hint(), no longer the property Engine.editor_hint. Then run the game headless and check Godot's output for errors.Verified on Godot 4.7.2
Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 6 October 2026, and the output above is what Godot printed, unedited.
Where the check lives in Godot's source: gdscript_parser.cpp line 1199, the message, Engine.is_editor_hint in the class reference.
Questions
- Does the order of @tool and extends matter?
- @tool goes before extends at the top of the file, as in the fixed script, alongside class_name and @icon.
Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.
Download Flockbay free