Read a config file
files_read_config_fileRead a Home Assistant config file's raw UTF-8 text before editing, resolving relative paths inside the config directory while blocking secrets.yaml, .storage, and disallowed extensions.
Instructions
Read one config file's raw text from the HA config directory.
Resolves relative_path under HA_CONFIG_PATH via _safe_path (blocking
paths outside the directory, disallowed extensions, and secrets.yaml/
.storage) and returns its content as a UTF-8 string; nothing is parsed
or validated.
Use when: reading the current text of a YAML/JSON/txt file before
editing it.
Not for: checking whether that text is valid YAML — pass it to
files_validate_yaml_content; discovering which files exist first —
use files_list_config_files.
Returns: str, the file's raw text (UTF-8).
Errors: raises FileNotFoundError when the file does not exist, and
raises PermissionError (from _safe_path) when relative_path
resolves outside the config directory, uses a disallowed extension, or
targets secrets.yaml/.storage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| relative_path | Yes | Path to the file relative to the HA config directory (HA_CONFIG_PATH), e.g. 'automations.yaml' or 'packages/lights.yaml'. Must resolve inside that directory, use an allowed extension (.yaml/.yml/.json/.txt), and not touch secrets.yaml or .storage/. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |