run_script
Execute custom GDScript code in a live Godot project. Run scripts with full scene tree access and return JSON-serialized results.
Instructions
Execute a custom GDScript in the live running project with full scene tree access. Requires an active runtime session. Script must extend RefCounted and define func execute(scene_tree: SceneTree) -> Variant. Return values are JSON-serialized (primitives, Vector2/3, Color, Dictionary, Array, and Node path strings). Use print() for debug output — it appears in get_debug_output, not in the result. In spawned mode, stderr runtime errors escalate to errors (when the script returns null) or surface as warnings. Returns: { success, result, warnings?, tip? } where result is the JSON-serialized return value of execute().
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | GDScript source code. Must contain "extends RefCounted" and "func execute(scene_tree: SceneTree) -> Variant". | |
| timeout | No | Timeout in ms (default: 30000). Increase for long-running scripts. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | ||
| result | No | ||
| warning | No | ||
| warnings | No | ||
| tip | No |