validate
Checks GDScript syntax and scene integrity using headless Godot, returning parse errors and structural problems early to prevent runtime failures.
Instructions
Validate GDScript syntax or scene integrity using headless Godot. Use before attach_script or run_script to catch parse errors early. Give exactly one of scriptPath, source, or scenePath, or a targets array validated in one Godot process. Returns { valid, errors } for one target, { results: [{ target, valid, errors }] } for a batch. An errors entry is { line?, message } for a parse error, or { check, problem?, message } for a checks[] finding. checks requires scenePath and instantiates the scene, running each attached script's _init(). Any parse error yields valid:false.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| checks | No | [single, requires scenePath] Structural and signal-verification checks to run against the scene. Types: "structure" (validate node tree against a schema) and "signals" (verify signal connections and handler methods, optional nodePath scope). Merged into the errors array with a "check" discriminator. | |
| 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 |