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.
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": {
"projectPath": "<projectPath>",
"scriptBody": "<scriptBody>"
},
"name": "run_gdscript"
}
}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) |