godot_run_script
Execute GDScript code within the Godot editor to query engine state, access project settings, or perform quick operations using EditorScript functionality.
Instructions
Executes a GDScript expression or block in the Godot editor context (via EditorScript). Useful for querying engine state or performing quick operations.
Args:
code (string): GDScript code to execute. Should be a valid expression or a series of statements. Has access to: Engine, ProjectSettings, EditorInterface (in editor context).
timeout_ms (number, optional): Max execution time in milliseconds (default: 5000, max: 30000).
Returns: { success: boolean, output: string, error?: string }
Examples:
Use when: "What is the current project name?" -> code: "ProjectSettings.get_setting('application/config/name')"
Use when: "List all files in res://levels/" -> code: "DirAccess.get_files_at('res://levels/')"
Warning: This runs arbitrary code in the editor. Use with care.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | GDScript code to execute | |
| timeout_ms | No | Execution timeout in ms |