# 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.

Source: https://flockbay.com/godot/tool-keyword-removed-in-godot-4/ · Updated 2026-10-30

## 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.

## Reproduce it

A Godot 3 tool script in a Godot 4 project. The scene is one Node with this script.

```
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

```
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

running in the editor: false
```

## Run 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.

```
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](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_parser.cpp#L1199), [Engine.is_editor_hint in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Engine.xml#L231).

## 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.

Download Flockbay free: Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot. https://flockbay.com/download/

Related: [The "export" keyword was removed in Godot 4: every export(...) and its @export annotation](/godot/export-keyword-removed-in-godot-4/), [The "onready" keyword was removed in Godot 4: use @onready](/godot/onready-keyword-removed-in-godot-4/), [Expected end of statement after variable declaration, found "Identifier" instead: setget in Godot 4](/godot/setget-in-godot-4/), ["yield" was removed in Godot 4. Use "await" instead: how to wait](/godot/wait-in-godot-4-await-instead-of-yield/), [Every verified Godot 4 answer](/godot/), [Does Flockbay change my Godot project?](/docs/does-flockbay-change-my-godot-project/)
