Set tool metadata in climate (#182701)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Paulus Schoutsen
2026-09-20 08:35:44 -07:00
committed by GitHub
co-authored by Claude
parent ea8ca3fe7e
commit bb56e6c5c8
+23 -4
View File
@@ -4,12 +4,25 @@ from homeassistant.components.homeassistant import async_should_expose
from homeassistant.components.llm import LLMTools
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import intent
from homeassistant.helpers.llm import LLM_API_ASSIST, IntentTool, LLMContext, Tool
from homeassistant.helpers.llm import (
LLM_API_ASSIST,
IntentTool,
LLMContext,
Tool,
ToolAnnotations,
)
from .const import DOMAIN, INTENT_SET_TEMPERATURE
# Intents owned by this integration that are exposed as LLM tools.
LLM_INTENTS = (INTENT_SET_TEMPERATURE,)
# Each intent sets a value on the user's own entities, so calling one again
# with the same arguments has no further effect.
LLM_ANNOTATIONS = ToolAnnotations(idempotent=True, open_world=False)
# Intents owned by this integration that are exposed as LLM tools, with the
# title shown for each.
LLM_INTENTS = {
INTENT_SET_TEMPERATURE: "Set temperature",
}
@callback
@@ -30,7 +43,13 @@ def async_get_tools(
return None
tools: list[Tool] = [
IntentTool(f"{DOMAIN}__{handler.intent_type}", handler)
IntentTool(
f"{DOMAIN}__{handler.intent_type}",
handler,
title=LLM_INTENTS[handler.intent_type],
integration=DOMAIN,
annotations=LLM_ANNOTATIONS,
)
for handler in intent.async_get(hass)
if handler.intent_type in LLM_INTENTS
]