Godai

v0.5.0
com.snopekgames/godai Checked 8 hours ago Published 2 months ago

Automate the Godot Engine editor: edit scenes and scripts, run projects, manage engine versions

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

pin_project_to_godot_version Pin Project to Godot Version

Records in the project which version of Godot it is built with, so that Godai always opens it with that version. This is written to a .godai.json config file in the project, which is meant to be committed, so that everyone working on it opens the same editor.

ParameterTypeDescription
godot_version *stringThe version or linked name to pin the project to, which must already be installed
project_path *stringThe absolute path to the project directory

set_godai_settings Set Godai Settings

Changes Godai's own settings, which configure Godai itself rather than anything inside the Godot project or editor. Only the settings that can be changed at runtime can be set here; the rest come from command-line arguments. Use get_godai_settings to see the current values.

ParameterTypeDescription
godot_versionstringThe version of Godot to use by default; it must already be installed, which list_installed_godot_versions shows
project_base_pathstringThe base path where the user's Godot projects live; can only be set when MCP is running with --global
update_checkstringWhether godai checks for its own updates

unpin_project_from_godot_version Unpin Project from Godot Version

Removes the version of Godot recorded in the project's .godai.json config file, leaving Godai to work out which version to open it with from the project itself.

ParameterTypeDescription
project_path *stringThe absolute path to the project directory

list_projects List Godot Projects

Lists the Godot projects that are available to open. When the MCP is running with --global, this includes the projects registered in the project manager and those under the project base path. Otherwise, this recursively searches the allowed root paths.

open_godot_project Open Godot Project

Opens a Godot project in a new Godot editor instance, if it isn't already open. Safe to call first for any project, open or not: one that is already open returns its running editor rather than starting a second one, so there is no need to check with list_open_projects beforehand. An editor that is already open keeps the version of Godot and the headless setting it was started with: headless is ignored for it, and asking for a godot_version it isn't running is an error rather than a silent no-op. Check already_open in the result to see whether an editor was already there.

ParameterTypeDescription
project_path *stringThe absolute path to the project directory
godot_versionstringOpen the project with this version of Godot, regardless of the version the project itself asks for, installing it if it isn't installed yet. Use a version from list_installed_godot_versions. Leave thi…
headlessbooleanLaunch the editor without visual or audio output (default: false)

list_open_projects List Open Godot Projects

Lists the projects currently open in a Godot editor, which version of Godot each one is open in, and whether that editor is headless.

get_godai_settings Get Godai Settings

Gets Godai's own settings, which configure Godai itself rather than anything inside the Godot project or editor. Only the settings that can be changed at runtime are included; the rest come from command-line arguments. Use set_godai_settings to change them.

set_editor_settings Set Editor Settings

Changes settings in the Godot editor itself (editor-wide preferences, not project settings). Pass 'settings': a map of setting name (e.g. 'text_editor/behavior/indent/size') to value. Values are strings in Godot variant syntax (e.g. `16`, `true`, `2.0`); a value that isn't valid variant syntax is taken as a raw string. An integer enum setting takes the option name (e.g. `Nearest`) or the integer value; setting one by integer returns a note with the matching option name, and an integer matching no option is still applied, with a warning. Setting names must already exist; unknown names are rej…

ParameterTypeDescription
settings *objectSettings to set (keys are setting names)
create_missingbooleanAllow creating settings that don't exist yet; without it, unknown setting names are rejected
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

clear_log_messages Clear Log Messages

Clears the log messages captured so far, so subsequent get_log_messages calls only return output from after this point. This only affects the captured messages; the editor's own Output panel is untouched.

ParameterTypeDescription
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

execute_editor_script Execute Editor Script

Executes the given GDScript code in the editor, in the context of a Node that is a child of the scene currently being edited. For modifying the current scene, use the other tools when possible. However, if you do use a script to modify the current scene, you MUST use `EditorUndoRedoManager` from `EditorInterface.get_editor_undo_redo()`, and the action name MUST end with "(Godai)". You can find nodes relative to the scene root using `EditorInterface.get_edited_scene_root().get_node_or_null(node_path)`. Two helper methods have been provided: - `func editor_undo_redo_create_node(p_undo_redo:…

ParameterTypeDescription
code *stringA snippet of GDScript code. It should use tabs rather than spaces for indentation. Don't wrap the code in a `_ready()` function.
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

set_node_properties Set Node Properties

Sets the values of properties on specific nodes in the current scene. Only pass the properties you wish to change. To discover the properties a node supports (and their current values), call get_node_properties with "include_defaults": true. EXAMPLE: {"action": "Move node", "nodes": {"path/to/node": {"position": "Vector2(1, 2)"}}} Property values are strings in Godot variant syntax: - String properties take the raw string, with NO extra quotes (e.g. "text": "Hello") - Other types use Godot syntax, e.g. `0.5`, `true`, `Vector2(1, 2)`, `Color(1, 0, 0, 1)`, `NodePath("../Other")` - Packed array…

ParameterTypeDescription
action *stringHuman-readable description of the action that will be shown in Godot's undo/redo history
nodes *objectKeys are the paths of the nodes to change, within the scene and relative to its root. A key may include a colon-separated property path (e.g. `MyMesh:mesh`) to address a resource or other sub-object.
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

remove_node Remove Node

Removes the given node (and all its children) from the current scene. Like all scene edits, the change is in-memory until save_scene: call it once you're done editing, or it is lost.

ParameterTypeDescription
node_path *stringPath to the node, relative to the scene root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

attach_script Attach Script

Attaches an existing script file to a node in the current scene. The script's base type must be compatible with the node's type. Use create_script first if the script doesn't exist yet. Like all scene edits, the attachment is in-memory until save_scene: call it once you're done editing, or it is lost.

ParameterTypeDescription
node_path *stringPath to the node, relative to the scene root
script_path *stringPath to the script file, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

create_script Create Script

Creates a new GDScript file. Does NOT open or attach it. If 'content' is given, it is used as the file's contents. Otherwise, a minimal script extending 'base_class' is generated.

ParameterTypeDescription
file_path *stringPath to the .gd file to create, relative to the project root
base_classstringBase class for the generated script when 'content' is omitted (default: Node)
contentstringFull contents of the script file. If omitted, a minimal template is generated.
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_editor_settings Get Editor Settings

Gets settings from the Godot editor itself (the values stored in the global editor configuration, e.g. 'text_editor/behavior/indent/size' or 'text_editor/appearance/whitespace/draw_tabs'). These are editor-wide preferences, not project settings. Pass 'names' to get specific settings by name (returned regardless of whether they match their default). Otherwise, all settings are returned, but only those whose value differs from the default; pass 'include_defaults' as true to also include settings left at their default value. Setting values are strings in Godot variant syntax. Integer enum setti…

ParameterTypeDescription
enums_as_intsbooleanReturn integer enum settings as their raw integer value, instead of translated to the option name (default: false)
include_defaultsbooleanWhen getting all settings, also include those left at their default value (default: false)
namesarraySpecific setting names to get. If omitted, all settings are returned.
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

set_project_settings Set Project Settings

Changes settings in the project and saves 'project.godot'. Pass 'settings': a map of setting name (e.g. 'display/window/size/viewport_width') to value. Values are strings in Godot variant syntax (e.g. `1280`, `true`, `2.0`); a value that isn't valid variant syntax is taken as a raw string. An integer enum setting takes the option name (e.g. `Nearest`) or the integer value; setting one by integer returns a note with the matching option name, and an integer matching no option is still applied, with a warning. Setting names must already exist; unknown names are rejected. Pass "create_missing":…

ParameterTypeDescription
settings *objectSettings to set (keys are setting names)
create_missingbooleanAllow creating settings that don't exist yet; without it, unknown setting names are rejected
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

instantiate_scene Instantiate Scene

Instantiates a saved scene (.tscn/.scn) as a child node in the current scene, like adding an instanced scene in the editor. Like all scene edits, the new instance is in-memory until save_scene: call it once you're done editing, or it is lost.

ParameterTypeDescription
scene_path *stringPath to the scene file to instantiate, relative to the project root
namestringName for the new instance node
parent_pathstringPath to the parent node, relative to the scene root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

detach_script Detach Script

Removes the script attached to a node in the current scene. Like all scene edits, the change is in-memory until save_scene: call it once you're done editing, or it is lost.

ParameterTypeDescription
node_path *stringPath to the node, relative to the scene root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

run_project Run Project

Runs the project from the editor. 'scene' controls what runs: omit it or use 'main' to run the project's main scene, 'current' to run the scene open in the editor, or a path to run a specific scene file.

ParameterTypeDescription
clear_log_messagesbooleanClear the captured log messages before running, so get_log_messages only returns output from this run onward (default: false)
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.
scenestringWhat to run: 'main' (default), 'current', or a path to a scene file

stop_project Stop Project

Stops the running project, if any.

ParameterTypeDescription
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

set_import_settings Set Import Settings

Changes the import settings for an imported asset, and reimports it. Only pass the options you wish to change. Option values are strings in Godot variant syntax (e.g. `2`, `true`, `2.0`); a value that isn't valid variant syntax is taken as a raw string. An unknown option name fails the whole call. On error, nothing is changed. Use get_import_settings to see the available option names and the current importer.

ParameterTypeDescription
file_path *stringPath to the imported asset, relative to the project root
importerstringChange the importer used for this asset
optionsobjectImport options to set (keys are option names)
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_log_messages Get Log Messages

Gets recent log output from the editor (print() output, warnings, and errors) captured since the editor started. Messages are sorted oldest first. Includes messages from both the editor and games run via `run_project`. Each line is prefixed with the local time it was captured, as '[HH:MM:SS.mmm]', so identical lines from different moments can be told apart.

ParameterTypeDescription
countintegerMaximum number of recent messages to return (default: 100). Use 0 for all retained messages.
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

restart_editor Restart Editor

Restarts the Godot editor for the project. The user is asked to confirm first, and the call fails if they decline. A headless editor restarts without asking. By default, unsaved changes are saved before restarting; pass 'skip_save' as true to discard them instead. If the project is running, it is stopped first.

ParameterTypeDescription
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.
skip_savebooleanDiscard unsaved changes instead of saving them before restarting (default: false)

create_resource Create Resource

Creates a new resource. Does NOT open it automatically. Property values are strings in Godot variant syntax: - String properties take the raw string, with NO extra quotes (e.g. "resource_name": "My Resource") - Other types use Godot syntax, e.g. `0.5`, `true`, `Vector2(1, 2)`, `Color(1, 0, 0, 1)` - Packed arrays take a flat list of components, so: `PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1)` is two colors (r,g,b,a, r,g,b,a), `PackedVector2Array(1, 2, 3, 4)` is two vectors - To reference a saved resource: `Resource("res://path/to/file.tres")` - To create an embedded resource: `Object(ClassName,…

ParameterTypeDescription
file_path *stringPath to the .tres file to create, relative to the project root
resource_type *stringThe resource type
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.
propertiesobjectKeys are the Godot property names to set

open_resource Open Resource

Opens a resource in the inspector.

ParameterTypeDescription
file_path *stringPath to the .tres file to open, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_resource_properties Get Resource Properties

Gets the values of properties on a saved resource file (e.g. a .tres file). Only properties whose value differs from the resource's default are returned; pass 'include_defaults' as true to also include properties left at their default value. Properties that Godot neither saves nor shows in the inspector are left out, since they're inactive given the resource's other properties (e.g. `alpha_scissor_threshold` on a material that isn't using alpha scissor); name one in 'properties' to read it anyway. Property values are strings in Godot variant syntax: - String properties are returned raw, wit…

ParameterTypeDescription
file_path *stringPath to the resource file, relative to the project root
enums_as_intsbooleanReturn integer enum properties as their raw integer value, instead of translated to the option name (default: false)
include_defaultsbooleanAlso include properties left at their default value (default: false)
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.
propertiesarrayThe properties to get. If omitted, all of the resource's properties are returned.

connect_signal Connect Signal

Connects a signal on one node to a method on another node, in the current scene. Both nodes must be in the current scene. The signal must exist on 'from_node', and the method on 'to_node'. Like all scene edits, the connection is in-memory until save_scene: call it once you're done editing, or it is lost.

ParameterTypeDescription
from_node *stringPath to the node emitting the signal, relative to the scene root
method *stringName of the method to call on the receiving node
signal *stringName of the signal to connect
to_node *stringPath to the node receiving the signal, relative to the scene root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

reimport Reimport Assets

Reimports one or more asset files (e.g. after changing the source file or its import settings). Each path must be an imported asset (i.e. have a .import file). On error, nothing is reimported.

ParameterTypeDescription
file_paths *arrayThe assets to reimport
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

close_editor Close Editor

Closes the Godot editor for the project. The user is asked to confirm first, and the call fails if they decline. A headless editor closes without asking. By default, unsaved changes are saved before closing; pass 'skip_save' as true to discard them instead. If the project is running, it is stopped first.

ParameterTypeDescription
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.
skip_savebooleanDiscard unsaved changes instead of saving them before closing (default: false)

add_to_group Add Node to Groups

Adds a node in the current scene to one or more groups. Like all scene edits, the change is in-memory until save_scene: call it once you're done editing, or it is lost.

ParameterTypeDescription
groups *arrayThe groups to add the node to
node_path *stringPath to the node, relative to the scene root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_node_groups Get Node Groups

Gets the groups that nodes in the current scene belong to. The results are returned in 'nodes', keyed by the requested node path.

ParameterTypeDescription
node_paths *arrayThe nodes to get the groups of
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

save_script Save Script

Saves a script's unsaved changes from the editor to its file. If the script is open in the editor, its current (possibly unsaved) contents are written to disk. If it isn't open, there is nothing to save and this is a no-op.

ParameterTypeDescription
file_path *stringPath to the .gd file, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_import_settings Get Import Settings

Gets the import settings for an imported asset (e.g. a texture or audio file). Option values are strings in Godot variant syntax.

ParameterTypeDescription
file_path *stringPath to the imported asset, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_project_settings Get Project Settings

Gets settings from the project (the values stored in 'project.godot', e.g. 'application/config/name' or 'display/window/size/viewport_width'). Pass 'names' to get specific settings by name (returned regardless of whether they match their default). Otherwise, all settings are returned, but only those whose value differs from the default; pass 'include_defaults' as true to also include settings left at their default value. Setting values are strings in Godot variant syntax. Integer enum settings are returned as their option name (e.g. `Nearest` instead of `0`), with a note pointing out the tra…

ParameterTypeDescription
enums_as_intsbooleanReturn integer enum settings as their raw integer value, instead of translated to the option name (default: false)
include_defaultsbooleanWhen getting all settings, also include those left at their default value (default: false)
namesarraySpecific setting names to get. If omitted, all settings are returned.
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

add_node Add Node

Creates a new node in the current scene, with the given properties set. Property values are strings in Godot variant syntax: - String properties take the raw string, with NO extra quotes (e.g. "name": "MyNode") - Other types use Godot syntax, e.g. `0.5`, `true`, `Vector2(1, 2)`, `Color(1, 0, 0, 1)`, `NodePath("../Other")` - Packed arrays take a flat list of components, so: `PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1)` is two colors (r,g,b,a, r,g,b,a), `PackedVector2Array(1, 2, 3, 4)` is two vectors - To reference a saved resource: `Resource("res://path/to/file.tres")` - To create an embedded res…

ParameterTypeDescription
node_type *stringThe name of the node class to create
parent_pathstringPath to the parent node, relative to the scene root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.
propertiesobjectKeys are the Godot property names to set

remove_from_group Remove Node from Groups

Removes a node in the current scene from one or more groups. Like all scene edits, the change is in-memory until save_scene: call it once you're done editing, or it is lost.

ParameterTypeDescription
groups *arrayThe groups to remove the node from
node_path *stringPath to the node, relative to the scene root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

open_script Open Script

Opens a script file in the editor's script editor.

ParameterTypeDescription
file_path *stringPath to the .gd file to open, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_node_properties Get Node Properties

Gets the values of properties on specific nodes in the current scene. Only properties whose value differs from the node's default are returned; pass 'include_defaults' as true to also include properties left at their default value. Properties that Godot neither saves nor shows in the inspector are left out, since they're derived from other properties (e.g. `global_position` comes from `transform`) or inactive given the node's other properties; ask for one by name (e.g. `MyNode:global_position`) to read it anyway. Property values are strings in Godot variant syntax: - String properties are r…

ParameterTypeDescription
node_paths *arrayThe nodes to get properties from
enums_as_intsbooleanReturn integer enum properties as their raw integer value, instead of translated to the option name (default: false)
include_defaultsbooleanAlso include properties left at their default value (default: false)
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_selected_nodes Get Selected Nodes

Gets the nodes currently selected in the editor for the current scene. If nothing is selected, 'node_paths' is an empty array.

ParameterTypeDescription
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

write_script Write Script

Replaces the entire contents of an existing script file. You must read the script with read_script first: this fails if the script has changed since you last read it (or created/wrote it), so you don't overwrite edits you haven't seen. If it fails for that reason, read the script again and reapply your change. If the script is open in the editor, its editor buffer is updated instead of the file on disk (so unsaved edits aren't silently clobbered); 'saved' will be false, and you can call save_script to write it to disk. If it isn't open, the file is written directly and 'saved' is true. Use…

ParameterTypeDescription
content *stringThe full new contents of the script, which may be empty to blank the script out
file_path *stringPath to the .gd file, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_current_scene Get Current Scene

Gets information about the scene that is currently opened in the Godot editor.

ParameterTypeDescription
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

get_current_scene_tree Get Scene Tree

Gets the tree for the scene that is currently opened in the Godot editor.

ParameterTypeDescription
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

create_scene Create Scene

Creates a new scene and opens it in the editor.

ParameterTypeDescription
file_path *stringPath to the .tscn file to create, relative to the project root
root_node_type *stringThe node type of the scene's root node
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

open_scene Open Scene

Opens a scene in the editor.

ParameterTypeDescription
file_path *stringPath to the .tscn file to open, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

set_resource_properties Set Resource Properties

Sets the values of properties on a saved resource file (.tres or .res), and saves the changes to the file. Only pass the properties you wish to change. To discover the properties a resource supports (and their current values), call get_resource_properties with "include_defaults": true. EXAMPLE: {"action": "Change color", "file_path": "res://thing.tres", "properties": {"albedo_color": "Color(1, 0, 0, 1)"}} Property values are strings in Godot variant syntax: - String properties take the raw string, with NO extra quotes (e.g. "resource_name": "My Resource") - Other types use Godot syntax, e.g.…

ParameterTypeDescription
action *stringHuman-readable description of the action that will be shown in Godot's undo/redo history
file_path *stringPath to the .tres or .res file, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.
propertiesobjectKeys are the Godot property names to set (colon-separated sub-paths allowed, e.g. `albedo_color:r`)

save_scene Save Scene

Saves the scene currently open in the editor to its file. If the scene has never been saved, use save_scene_as instead.

ParameterTypeDescription
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

read_script Read Script

Reads the contents of a script file. If the script is currently open in the editor, its live (possibly unsaved) buffer is returned and 'open_in_editor' is true. Otherwise the contents are read from disk.

ParameterTypeDescription
file_path *stringPath to the .gd file, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

save_scene_as Save Scene As

Saves the scene currently open in the editor to the given path, changing the path of the current scene, such that subsequent save_scene calls would save to the new path.

ParameterTypeDescription
file_path *stringPath to the .tscn file to save to, relative to the project root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.

disconnect_signal Disconnect Signal

Disconnects a previously-connected signal between two nodes in the current scene. Like all scene edits, the change is in-memory until save_scene: call it once you're done editing, or it is lost.

ParameterTypeDescription
from_node *stringPath to the node emitting the signal, relative to the scene root
method *stringName of the connected method on the receiving node
signal *stringName of the signal to disconnect
to_node *stringPath to the node receiving the signal, relative to the scene root
project_pathstringThe path to the Godot project. It must already be open in the Godot editor.