-
Notifications
You must be signed in to change notification settings - Fork 56
Description
What would you like to see?
Three tool consolidations to reduce tool count by 5 (93 → 88). All merge tools that share internal helpers or are near-identical code in the same file.
1. Merge area + floor tools (6 → 3, saves 3 tools)
ha_config_list_areas + ha_config_list_floors, ha_config_set_area + ha_config_set_floor, ha_config_remove_area + ha_config_remove_floor
All 6 live in tools_areas.py and are structurally identical — same WebSocket pattern (config/{area,floor}_registry/{list,create,update,delete}), same error handling, nearly identical parameters. The only differences are floor-specific params (level) vs area-specific params (floor_id, picture).
Approach: Add a type: Literal["area", "floor"] parameter (default "area") to each combined tool. Type-specific params are optional and only apply to their respective type. For the list tool, could also just return both areas and floors in a single call since both datasets are small.
2. Merge ha_rename_entity + ha_rename_entity_and_device (2 → 1, saves 1 tool)
Both already share _rename_entity_internal() in tools_registry.py. The combo tool is a thin wrapper that additionally looks up the device_id from the entity registry and calls _update_device_internal().
Approach: Add optional new_device_name param to ha_rename_entity. If provided, do the device lookup + rename. If omitted, behavior is identical to today. The new_entity_name param from the combo tool maps to the existing name param on ha_rename_entity.
3. Merge ha_get_operation_status + ha_get_bulk_status (2 → 1, saves 1 tool)
Both are read-only tools in tools_service.py checking async device operation status. Both delegate to device_tools. The bulk version loops over individual operations and aggregates results.
Approach: Make ha_get_operation_status accept operation_id: str | list[str]. Single string returns single status (current behavior). List returns aggregated results (current bulk behavior).
Why do you need this?
These are duplicates or near-duplicates that inflate the tool count without adding distinct functionality. Each consolidation follows patterns already established in the codebase — the str | list pattern is used by ha_get_entity/ha_set_entity, and the area+floor tools are already in the same file sharing the same structure.
Additional context
Per AGENTS.md: "When a tool's functionality is fully covered by another tool, remove the redundant tool rather than deprecating it. Fewer tools reduces cognitive load for AI agents and improves decision-making."