Commit 6ed6d3b
* feat: consolidate diagnostic capabilities into existing tools
Rename ha_get_logbook to ha_get_logs with source parameter supporting
logbook (default), system (system_log/list), error_log (raw home-assistant.log),
and supervisor (add-on container logs).
Expand ha_get_system_health with include parameter for repairs
(repairs/list_issues) and zha_network (zha/devices with LQI/RSSI).
Add ZHA radio metrics (LQI/RSSI) auto-enrichment to ha_get_device
for single ZHA device lookups.
Add repair issue count and details to ha_get_overview.
Zero new tools added — all capabilities integrated into existing tools.
Closes #684
Closes #824
Inspired by #675 (@lcrostarosa)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: resolve mypy errors, address review feedback, add e2e tests
- Fix send_command() calls to pass string command type, not dict
- Remove redundant None checks after coerce_int_param (Gemini review)
- Replace bare except with logged warning for ZHA metrics (Gemini review)
- Revert unintended ruff formatting changes in tools_registry.py and
tools_system.py to keep diff focused on functional changes
- Add e2e tests for new log sources (system, error_log, invalid source,
invalid level, supervisor without slug, default source)
- Add e2e tests for system health include parameter (repairs, default)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: resolve mypy type errors and e2e test failures
- Add assert for non-None after coerce_int_param (mypy needs narrowing
since return type is int | None even with non-None default)
- Fix validation error tests to use pytest.raises(ToolError) since
raise_tool_error raises ToolError, not a dict response
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: remove unused parse_mcp_result import to fix ruff lint
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: address review feedback — Literal types, narrowed exceptions, search support, ZHA optimization
- Add Literal type for ha_get_logs source param (exposes enum in JSON schema)
- Add search keyword filtering to logbook source (was silently ignored)
- Narrow all broad except Exception blocks to specific types per repo guidelines
- Fix error_log level filtering: regex-based matching instead of naive substring
- Optimize ZHA enrichment: O(1) dict lookup, stripped-down response fields
- Add zha_network_full option for complete ZHA device data
- Add coerce_int_param overloads to eliminate assert workarounds
- Rename DEFAULT_LOGBOOK_LIMIT/MAX_LOGBOOK_LIMIT to generic names
- Warn on source-incompatible parameter combinations
- Improve supervisor log dict fallback with warning
- Revert formatting-only changes in ha_eval_template
- Add tests: search filter, error_log level, ZHA network, combined include,
overview repair_count
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: handle ToolError in ZHA/combined system health E2E tests
system_health WebSocket call raises ToolError in CI Docker containers
where the component isn't available. Wrap call_tool in try/except and
skip when system_health is unavailable.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: skip system health tests on any ToolError in CI
The CI Docker container returns "Unknown command" for system_health/info,
not "timeout" or "not available". Skip on any ToolError since the tool
itself can't succeed without the system_health component.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: use broad except for error-isolation blocks, proper test assertions
The WebSocket client raises plain Exception for unknown commands (e.g.
"zha/devices" when ZHA isn't installed). Section-level error isolation
blocks (repairs, ZHA in system_health/overview/device) must catch
Exception to gracefully degrade — narrowing to TimeoutError/OSError
caused the whole tool to fail when any optional section's command was
unknown.
Revert tests to proper assertions (no blind skip) — with error isolation
fixed, the tool returns success with error info in the section, so tests
can actually verify the response structure.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: credit @lcrostarosa in README contributors
Co-Authored-By: Lucas Crostarosa <12022083+lcrostarosa@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: kingpanther13 <kingpanther13@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Lucas Crostarosa <12022083+lcrostarosa@users.noreply.github.com>
1 parent c8afd28 commit 6ed6d3b
13 files changed
Lines changed: 1381 additions & 2995 deletions
File tree
- homeassistant-addon
- site/src/data
- src/ha_mcp/tools
- tests
- src
- e2e
- tools
- utilities
- workflows/system
- unit
- uat/stories/catalog
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
| 367 | + | |
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
563 | 564 | | |
564 | 565 | | |
565 | 566 | | |
566 | | - | |
| 567 | + | |
567 | 568 | | |
568 | 569 | | |
569 | 570 | | |
570 | | - | |
| 571 | + | |
571 | 572 | | |
572 | 573 | | |
573 | 574 | | |
| |||
589 | 590 | | |
590 | 591 | | |
591 | 592 | | |
592 | | - | |
| 593 | + | |
593 | 594 | | |
594 | 595 | | |
595 | 596 | | |
| |||
609 | 610 | | |
610 | 611 | | |
611 | 612 | | |
612 | | - | |
| 613 | + | |
613 | 614 | | |
614 | 615 | | |
615 | 616 | | |
| |||
625 | 626 | | |
626 | 627 | | |
627 | 628 | | |
628 | | - | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
629 | 632 | | |
630 | 633 | | |
631 | 634 | | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
632 | 640 | | |
633 | 641 | | |
634 | 642 | | |
635 | 643 | | |
636 | | - | |
| 644 | + | |
637 | 645 | | |
638 | 646 | | |
639 | 647 | | |
| |||
695 | 703 | | |
696 | 704 | | |
697 | 705 | | |
698 | | - | |
| 706 | + | |
699 | 707 | | |
700 | 708 | | |
| 709 | + | |
701 | 710 | | |
702 | 711 | | |
703 | 712 | | |
| |||
719 | 728 | | |
720 | 729 | | |
721 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
722 | 735 | | |
723 | 736 | | |
724 | 737 | | |
| |||
730 | 743 | | |
731 | 744 | | |
732 | 745 | | |
| 746 | + | |
| 747 | + | |
733 | 748 | | |
734 | 749 | | |
735 | 750 | | |
| |||
762 | 777 | | |
763 | 778 | | |
764 | 779 | | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
765 | 784 | | |
766 | 785 | | |
767 | 786 | | |
| |||
795 | 814 | | |
796 | 815 | | |
797 | 816 | | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
798 | 878 | | |
799 | 879 | | |
800 | 880 | | |
| |||
825 | 905 | | |
826 | 906 | | |
827 | 907 | | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
843 | 917 | | |
844 | 918 | | |
845 | 919 | | |
| |||
892 | 966 | | |
893 | 967 | | |
894 | 968 | | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
895 | 974 | | |
896 | 975 | | |
897 | 976 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
665 | 665 | | |
666 | 666 | | |
667 | 667 | | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
668 | 691 | | |
669 | 692 | | |
670 | 693 | | |
| |||
0 commit comments