From 9c9e14e79cdf5132d7a98e85559c893139f32898 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 30 Oct 2026 23:25:51 -0400 Subject: [PATCH] fix(homeassistant): its MCP tools register, stating read_only as the server requires (#6355) Without it the plugin's hook raised at boot and left it with no tools. The test's stand-in for register gave read_only a default, so now both arguments are required there too. Co-Authored-By: Claude Opus 5.5 --- plugins/homeassistant/mcp_tools.py | 2 +- tests/plugins/homeassistant/test_service.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/homeassistant/mcp_tools.py b/plugins/homeassistant/mcp_tools.py index 544fb3b..ffdaaae 100644 --- a/plugins/homeassistant/mcp_tools.py +++ b/plugins/homeassistant/mcp_tools.py @@ -108,4 +108,4 @@ async def mcp_overview(db) -> list[dict]: def register_tools(register) -> None: register(get_home_assistant, role=UserRole.viewer, read_only=True) - register(update_home_assistant, role=UserRole.admin) + register(update_home_assistant, role=UserRole.admin, read_only=False) diff --git a/tests/plugins/homeassistant/test_service.py b/tests/plugins/homeassistant/test_service.py index 444c4cb..936d928 100644 --- a/tests/plugins/homeassistant/test_service.py +++ b/tests/plugins/homeassistant/test_service.py @@ -129,7 +129,10 @@ def test_the_overview_names_what_needs_a_look_and_no_more(): def test_reading_is_open_to_a_viewer_and_installing_is_for_an_admin(): seen = {} - homeassistant_plugin.register_mcp_tools(lambda fn, role, read_only=False: seen.update({fn.__name__: (role, read_only)})) + + def register(fn, *, role, read_only): # both required, as on the server + seen[fn.__name__] = (role, read_only) + homeassistant_plugin.register_mcp_tools(register) assert seen == {"get_home_assistant": (UserRole.viewer, True), "update_home_assistant": (UserRole.admin, False)}