validate
Validate GDScript syntax or scene file integrity with headless Godot. Catch parse errors early before running scripts or attaching them to scenes.
Instructions
Validate GDScript syntax or scene file integrity using headless Godot. Use before attach_script or run_script to catch parse errors early. Single-target: provide exactly one of scriptPath, source, or scenePath. Batch: provide a targets array — runs all in one Godot process. Returns { valid, errors: [{ line?, message }] } for single, or { results: [{ target, valid, errors }] } for batch. Line numbers appear when Godot's stderr includes them (not always). Returns valid:false on any parse error; never throws.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | No | [single] Inline GDScript source code to validate. Written to a temporary file and validated against the project. | |
| targets | No | [batch] Array of targets to validate in a single Godot process. Each item must have exactly one of: scriptPath, source, or scenePath. | |
| scenePath | No | [single] Path to a .tscn scene file relative to the project to validate (e.g. "scenes/main.tscn") | |
| scriptPath | No | [single] Path to a .gd file relative to the project to validate (e.g. "scripts/player.gd") | |
| projectPath | Yes | Path to the Godot project directory |