validate
Check GDScript syntax or scene file integrity to catch parse errors early. Supports single files or batch targets in a single Godot process.
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 |
|---|---|---|---|
| projectPath | Yes | Path to the Godot project directory | |
| scriptPath | No | [single] Path to a .gd file relative to the project to validate (e.g. "scripts/player.gd") | |
| source | No | [single] Inline GDScript source code to validate. Written to a temporary file and validated against the project. | |
| scenePath | No | [single] Path to a .tscn scene file relative to the project to validate (e.g. "scenes/main.tscn") | |
| targets | No | [batch] Array of targets to validate in a single Godot process. Each item must have exactly one of: scriptPath, source, or scenePath. |