mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Adjust config entry state checks in mcp_server (#138913)
This commit is contained in:
parent
1392bab4d5
commit
08358514b4
@ -25,7 +25,6 @@ from mcp import types
|
|||||||
|
|
||||||
from homeassistant.components import conversation
|
from homeassistant.components import conversation
|
||||||
from homeassistant.components.http import KEY_HASS, HomeAssistantView
|
from homeassistant.components.http import KEY_HASS, HomeAssistantView
|
||||||
from homeassistant.config_entries import ConfigEntryState
|
|
||||||
from homeassistant.const import CONF_LLM_HASS_API
|
from homeassistant.const import CONF_LLM_HASS_API
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import llm
|
from homeassistant.helpers import llm
|
||||||
@ -56,11 +55,9 @@ def async_get_config_entry(hass: HomeAssistant) -> MCPServerConfigEntry:
|
|||||||
|
|
||||||
Will raise an HTTP error if the expected configuration is not present.
|
Will raise an HTTP error if the expected configuration is not present.
|
||||||
"""
|
"""
|
||||||
config_entries: list[MCPServerConfigEntry] = [
|
config_entries: list[MCPServerConfigEntry] = (
|
||||||
config_entry
|
hass.config_entries.async_loaded_entries(DOMAIN)
|
||||||
for config_entry in hass.config_entries.async_entries(DOMAIN)
|
)
|
||||||
if config_entry.state == ConfigEntryState.LOADED
|
|
||||||
]
|
|
||||||
if not config_entries:
|
if not config_entries:
|
||||||
raise HTTPNotFound(text="Model Context Protocol server is not configured")
|
raise HTTPNotFound(text="Model Context Protocol server is not configured")
|
||||||
if len(config_entries) > 1:
|
if len(config_entries) > 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user