From 6f9bda36c3cecbb270481e116ecf8afa8386a3e5 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 24 Sep 2026 20:26:40 +0100 Subject: [PATCH] Set tool metadata in assist_satellite (#182708) Co-authored-by: Claude --- .../components/assist_satellite/llm.py | 20 +++++++++++++++++-- tests/components/assist_satellite/test_llm.py | 9 ++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/assist_satellite/llm.py b/homeassistant/components/assist_satellite/llm.py index fe5e631eafc1..5db3c4bf6a99 100644 --- a/homeassistant/components/assist_satellite/llm.py +++ b/homeassistant/components/assist_satellite/llm.py @@ -3,10 +3,20 @@ 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 +# A broadcast announces something every time it is called and takes nothing +# away, and it only reaches the user's own satellites. +LLM_ANNOTATIONS = ToolAnnotations(destructive=False, open_world=False) + @callback def async_get_tools( @@ -19,7 +29,13 @@ def async_get_tools( # assist_satellite registers the broadcast intent when it is set up, and # this platform is only queried once that has happened. tools: list[Tool] = [ - IntentTool(f"{DOMAIN}__{handler.intent_type}", handler) + IntentTool( + f"{DOMAIN}__{handler.intent_type}", + handler, + title="Broadcast message", + integration=DOMAIN, + annotations=LLM_ANNOTATIONS, + ) for handler in intent.async_get(hass) if handler.intent_type == intent.INTENT_BROADCAST ] diff --git a/tests/components/assist_satellite/test_llm.py b/tests/components/assist_satellite/test_llm.py index 5ace33d9865c..ec911a2c13cf 100644 --- a/tests/components/assist_satellite/test_llm.py +++ b/tests/components/assist_satellite/test_llm.py @@ -31,4 +31,11 @@ def _llm_context() -> llm.LLMContext: async def test_broadcast_tool_offered(hass: HomeAssistant) -> None: """Test the broadcast intent is exposed as an LLM tool.""" result = await llm_component.async_get_tools(hass, _llm_context(), "assist") - assert "assist_satellite__HassBroadcast" in [tool.name for tool in result.tools] + tools = {tool.name: tool for tool in result.tools} + assert "assist_satellite__HassBroadcast" in tools + + tool = tools["assist_satellite__HassBroadcast"] + assert tool.title == "Broadcast message" + assert tool.integration == "assist_satellite" + # A broadcast announces again on every call and takes nothing away. + assert tool.annotations == llm.ToolAnnotations(destructive=False, open_world=False)