Validate YAML syntax
files_validate_yaml_contentValidate a YAML string's syntax without writing, accepting Home Assistant tags as opaque values. Use before writing config files or automation configs to catch parse errors.
Instructions
Check YAML syntax for a string without writing anything.
Parses content with a Home-Assistant-tolerant YAML loader that
accepts !include*/!secret/!env_var/!input as opaque values, and reports
only whether parsing succeeded and the top-level type.
Use when: checking a YAML snippet's syntax before calling
files_write_config_file or automations_set_automation_config.
Not for: full HA schema validation — use system_check_config; HA tags
here are accepted but not resolved, so only syntax is checked, not HA
schema validity.
Returns: dict {"valid": True, "type": ...} (top-level type name only,
not the parsed content) or {"valid": False, "error": ...}.
Errors: returns {"valid": False, "error": str(e)} for a YAML parse
error rather than raising.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | YAML text to check for syntax errors; nothing is written or read from disk. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||