@@ -124,13 +124,12 @@ async def ha_hacs_info() -> dict[str, Any]:
124124 e ,
125125 context = {"tool" : "ha_hacs_info" },
126126 raise_error = False ,
127- )
128- if "error" in error_response and isinstance (error_response ["error" ], dict ):
129- error_response ["error" ]["suggestions" ] = [
127+ suggestions = [
130128 "Verify HACS is installed: https://hacs.xyz/" ,
131129 "Check Home Assistant connection" ,
132130 "Restart Home Assistant if HACS was recently installed" ,
133- ]
131+ ],
132+ )
134133 error_with_tz = await add_timezone_metadata (client , error_response )
135134 raise_tool_error (error_with_tz )
136135
@@ -244,13 +243,12 @@ async def ha_hacs_list_installed(
244243 e ,
245244 context = {"tool" : "ha_hacs_list_installed" , "category" : category },
246245 raise_error = False ,
247- )
248- if "error" in error_response and isinstance (error_response ["error" ], dict ):
249- error_response ["error" ]["suggestions" ] = [
246+ suggestions = [
250247 "Verify HACS is installed: https://hacs.xyz/" ,
251248 "Check category name is valid: integration, lovelace, theme, appdaemon, python_script" ,
252249 "Check Home Assistant connection" ,
253- ]
250+ ],
251+ )
254252 error_with_tz = await add_timezone_metadata (client , error_response )
255253 raise_tool_error (error_with_tz )
256254
@@ -425,13 +423,12 @@ async def ha_hacs_search(
425423 e ,
426424 context = {"tool" : "ha_hacs_search" , "query" : query , "category" : category },
427425 raise_error = False ,
428- )
429- if "error" in error_response and isinstance (error_response ["error" ], dict ):
430- error_response ["error" ]["suggestions" ] = [
426+ suggestions = [
431427 "Verify HACS is installed: https://hacs.xyz/" ,
432428 "Try a simpler search query" ,
433429 "Check category name is valid: integration, lovelace, theme, appdaemon, python_script" ,
434- ]
430+ ],
431+ )
435432 error_with_tz = await add_timezone_metadata (client , error_response )
436433 raise_tool_error (error_with_tz )
437434
@@ -543,13 +540,12 @@ async def ha_hacs_repository_info(repository_id: str) -> dict[str, Any]:
543540 e ,
544541 context = {"tool" : "ha_hacs_repository_info" , "repository_id" : repository_id },
545542 raise_error = False ,
546- )
547- if "error" in error_response and isinstance (error_response ["error" ], dict ):
548- error_response ["error" ]["suggestions" ] = [
543+ suggestions = [
549544 "Verify HACS is installed: https://hacs.xyz/" ,
550545 "Check repository ID format (e.g., 'hacs/integration' or 'owner/repo')" ,
551546 "Use ha_hacs_search() to find the correct repository ID" ,
552- ]
547+ ],
548+ )
553549 error_with_tz = await add_timezone_metadata (client , error_response )
554550 raise_tool_error (error_with_tz )
555551
@@ -668,15 +664,14 @@ async def ha_hacs_add_repository(
668664 "category" : category ,
669665 },
670666 raise_error = False ,
671- )
672- if "error" in error_response and isinstance (error_response ["error" ], dict ):
673- error_response ["error" ]["suggestions" ] = [
667+ suggestions = [
674668 "Verify HACS is installed: https://hacs.xyz/" ,
675669 "Check repository format: 'owner/repo'" ,
676670 "Verify the repository exists on GitHub" ,
677671 "Ensure category matches repository type" ,
678672 "Check repository follows HACS guidelines: https://hacs.xyz/docs/publish/start" ,
679- ]
673+ ],
674+ )
680675 error_with_tz = await add_timezone_metadata (client , error_response )
681676 raise_tool_error (error_with_tz )
682677
@@ -806,13 +801,12 @@ async def ha_hacs_download(
806801 "version" : version ,
807802 },
808803 raise_error = False ,
809- )
810- if "error" in error_response and isinstance (error_response ["error" ], dict ):
811- error_response ["error" ]["suggestions" ] = [
804+ suggestions = [
812805 "Verify HACS is installed: https://hacs.xyz/" ,
813806 "Check repository ID is valid (use ha_hacs_search() to find it)" ,
814807 "Ensure the repository is in HACS (use ha_hacs_add_repository() if needed)" ,
815808 "Check version format (e.g., 'v1.2.3' or '1.2.3')" ,
816- ]
809+ ],
810+ )
817811 error_with_tz = await add_timezone_metadata (client , error_response )
818812 raise_tool_error (error_with_tz )
0 commit comments