run_script
Run custom GDScript in a live Godot project with full scene tree access. Script must extend RefCounted and define execute(scene_tree).
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 |
|---|---|---|---|
| tip | No | ||
| result | No | ||
| success | No | ||
| warnings | No |