Run Godot headless
godot_cliRun Godot 4 headlessly to import assets, smoke-test scenes, export presets, and execute GDScript from the command line without opening a window.
Instructions
Run the Godot 4 engine from the command line with --headless (dummy renderer, no window ever appears) on a text project (project.godot, .tscn, .tres, .gd). Pass projectPath (the folder with project.godot). Common: args ["--import"] imports assets and generates .import/.uid files (Godot 4.3+; older: ["--editor", "--quit"]); args ["--quit-after", "120"] smoke-tests the main scene for 120 frames; args ["--export-release", "Web", "/abs/out/index.html"] exports a preset from export_presets.cfg (export templates for the exact version must be installed); args ["--version"]. Run GDScript with code or scriptPath: code without an extends line is wrapped as a SceneTree script that quits when done; a full script must extend SceneTree or MainLoop and call quit(). Script and engine errors (ERROR:, SCRIPT ERROR:) are collected and fail the call, since Godot often exits 0 after them. Headless renders no frames: for screenshots export to Web and capture in headless Chromium. Refuses the project manager and window-only flags; allowWindow: true lifts that for Movie Maker (--write-movie) captures, only when the user has agreed to a window.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "godot_cli"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Godot arguments, e.g. ["--import"] or ["--export-release", "Web", "/abs/path/index.html"] | |
| code | No | GDScript to run (with --script). Without `extends`, it is wrapped in a SceneTree script that quits when done | |
| userArgs | No | Arguments for the script, read with OS.get_cmdline_user_args() | |
| scriptPath | No | A .gd file to run instead of code: absolute path or res:// path | |
| allowWindow | No | Run without --headless. Only for Movie Maker captures the user explicitly agreed to | |
| projectPath | No | Folder containing project.godot, usually the job's game/ folder | |
| failOnErrors | No | Treat ERROR / SCRIPT ERROR lines in the output as failure | |
| timeoutMinutes | No |