From c5a82be26ea655e1114b2905bb373367a86b438c Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 24 Sep 2026 20:26:36 +0100 Subject: [PATCH] Set tool metadata in calendar (#182710) Co-authored-by: Claude --- homeassistant/components/calendar/llm.py | 6 ++++++ tests/components/calendar/test_llm.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/homeassistant/components/calendar/llm.py b/homeassistant/components/calendar/llm.py index ca4afea6444a..949ba6bce204 100644 --- a/homeassistant/components/calendar/llm.py +++ b/homeassistant/components/calendar/llm.py @@ -14,6 +14,7 @@ from homeassistant.helpers.llm import ( LLM_API_ASSIST, LLMContext, Tool, + ToolAnnotations, ToolInput, ToolResult, ) @@ -27,11 +28,16 @@ class CalendarGetEventsTool(Tool): """LLM Tool allowing querying a calendar.""" name = "calendar__get_events" + title = "Get calendar events" description = ( "Get events from a calendar. " "When asked if something happens, search the whole week. " "Results are RFC 5545 which means 'end' is exclusive." ) + annotations = ToolAnnotations( + read_only=True, destructive=False, idempotent=True, open_world=False + ) + integration = DOMAIN def __init__(self, calendars: list[str]) -> None: """Init the get events tool.""" diff --git a/tests/components/calendar/test_llm.py b/tests/components/calendar/test_llm.py index 0cb64a47163c..05361df2425d 100644 --- a/tests/components/calendar/test_llm.py +++ b/tests/components/calendar/test_llm.py @@ -62,6 +62,11 @@ async def test_calendar_get_events_tool(hass: HomeAssistant) -> None: ) assert tool is not None assert tool.parameters.schema["calendar"].container == ["Mock Calendar Name"] + assert tool.title == "Get calendar events" + assert tool.integration == calendar.DOMAIN + assert tool.annotations == llm.ToolAnnotations( + read_only=True, destructive=False, idempotent=True, open_world=False + ) calls = async_mock_service( hass,