Community藝術與設計github.com

aigengame/godot-agent

Agent-first CLI, Skill, and MCP server for the Godot game engine — structured, machine-readable operations that let AI agents build games: scenes, nodes, scripts & exports headlessly, plus live control of a running game.

相容平台~Claude Code~Codex CLI~Cursor
npx skills add aigengame/godot-agent

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

說明文件

gda is an agent-first CLI for the Godot engine: every operation is one command with structured JSON output, so you build and inspect a game without opening the editor. Two kinds of operation: headless (a one-shot godot --headless per call — scenes, scripts, exports) and live (against a running game via the gda-daemon).

Grammar

gda <group> <command> [options] --json

Exactly one JSON result is printed to stdout; all engine noise (warnings, progress, the engine banner) goes to stderr. Read stdout, ignore stderr unless debugging. info / schema / skill are top-level meta commands (no group).

Setup

  • Engine — set GDA_GODOT to your Godot binary (or pass --godot PATH).
  • Project — resolved by --project DIR$GDA_PROJECT → the current directory; the directory must contain project.godot. Resolving a project runs that project's autoloads at engine startup.
  • Projectless — meta commands and file-path-only operations run with no project; they resolve filesystem paths but not res://.

Structured output & errors

Always pass --json. A success is the operation's result object. A failure is

{"error": {"category": "...", "code": "...", "message": "..."}}

Branch on the stable category/code and the exit code, never on prose:

ExitMeaning
0success
127Godot binary not found
124engine timed out
3engine version too old
4operation-reported failure
5could not parse the engine's output
6live operation failed (e.g. daemon_not_running)

Discovery

  • gda --help — every group.
  • gda <group> --help — a group's commands.
  • gda <group> <command> --schema — one command's input/output/error JSON Schema (no Godot spawned).
  • gda schema — the whole surface as one JSON manifest.

Headless commands (Godot 4.4+, all platforms)

GroupCommands
scenecreate, get, list, get-exports, delete (.tscn files)
nodeadd, get, list, set, remove, duplicate, move, connect-signal, disconnect-signal (nodes within a scene)
scriptcreate, get, list, set, delete, attach, validate (.gd files)
projectinfo, get, set, add-autoload, remove-autoload, find-references, dependencies, find-unused-resources, statistics
resourcecreate, get, set, delete, uid (.tres files)
exportlist, get, run (export a preset by name; --mode release/debug/pack)
shadercreate, get, set (.gdshader files)
themecreate (a loadable .tres Theme)

Live operations (via the daemon; Godot 4.6+, macOS/Linux)

Prerequisites: run gda daemon start first; the engine session launches lazily on the first live op. screen capture needs a windowed session (gda daemon start --windowed).

GroupCommands
daemonstart, stop, status, uninstall (lifecycle; installs the in-game harness)
gametree, get, set (the running game's runtime scene graph)
diagerrors, log (runtime errors / output log; survive a crash)
perfmonitors, monitor (counters now / a property-or-signal timeline)
inputkey, mouse-click, mouse-move, action, sequence
screencapture, frames (viewport PNGs; needs --windowed)

Worked example

Headless: build and export a scene.

export GDA_GODOT="/path/to/Godot"
gda scene create game/main.tscn --root-type Node2D --project game --json
gda node add  game/main.tscn --type Sprite2D --name Hero --project game --json
gda node set  game/main.tscn --node Hero --property position --value "100,50" --project game --json
gda export run --preset "Linux/X11" --output build/game.zip --project game --json  # --preset: a name from 'gda export list'

Live: observe the running game, then tear down.

gda daemon start --project game --json     # launches the session on the first live op
gda game tree --project game --json        # the runtime scene tree, after _ready
gda daemon stop --project game --json

Tips

  • Node paths are relative to the scene root; . is the root itself.
  • --value is coerced to the property's declared Godot type — the same coercion for node set, resource set, project set, and live game set.
  • For large or scripted input, pass one JSON object with --params-json '{...}' (or --params-json - to read it from stdin) instead of individual flags.
  • Live ops with no daemon report daemon_not_running (exit 6) and name the remedy — start the daemon and retry.

相關技能