run_gdscript
Execute GDScript code snippets headlessly within Godot projects for testing and calculations. Provide project path and script statements to run without manual SceneTree setup.
Instructions
Run a GDScript snippet headlessly inside a project and return the output. The script body is wrapped in a SceneTree subclass automatically — just write the statements to execute (e.g. print("hello")). Great for quick tests and calculations that need Godot's built-in types.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Absolute path to the project directory | |
| scriptBody | Yes | GDScript statements to execute (no func wrapper needed). They will run inside _init() of a SceneTree subclass. | |
| timeoutMs | No | Maximum run time in milliseconds (default: 30000) |