Run GDScript
execRun a GDScript snippet in the Godot editor or running game when no dedicated action fits—use for bulk procedural generation, one-off fixes, or complex queries.
Instructions
Escape hatch: run a GDScript snippet in the editor or in the running game when no dedicated action fits (bulk procedural generation, one-off fixes, complex queries). Prefer dedicated tools; file changes made here are still tracked by changesets.
Actions:
editor: {code} body of func run(editor: EditorInterface, scene: Node, forge) -> Variant;
returna value. forge.find_node(path), forge.begin(name)/forge.commit() for undoable edits.game: {code} body of func run(tree: SceneTree, scene: Node) in the running game;
returna value.eval: {expression, path?} evaluate one expression in the editor with a node as self.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | GDScript statements (tabs or spaces, consistently). | |
| path | No | Node path relative to the scene root ('.' = root, 'Player/Sprite2D', '%Unique'), or a res:// file path, depending on the action. | |
| action | Yes | What to do. See the tool description for each action's parameters. | |
| expression | No | Single Godot Expression. |