You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: Signal tool errors via isError for automation, service, and registry tools (#518)
Part 1 of the isError signaling fix. Adds core infrastructure and applies
to tools that already have comprehensive E2E test coverage.
Core changes:
- Add raise_tool_error() helper to convert error dicts to ToolError exceptions
- Update exception_to_structured_error() to raise by default (raise_error=True)
- Add @overload type signatures for raise_error parameter
- Add safe_call_tool() and tool_error_to_result() test utilities
Tool changes (3 tools with existing E2E tests):
- tools_config_automations: 5 error paths now raise ToolError
- tools_service: 4 error paths now raise ToolError
- tools_registry: 1 error path now raises ToolError
Test updates:
- Update 11 E2E test files to use safe_call_tool for error path testing
- Add unit tests for raise_tool_error and exception_to_structured_error
- Add retry logic for entity rename tests (timing robustness)
Closes part of #518https://claude.ai/code/session_01MvDDV6qmWosBfGhmTLYzo8
* refactor: use match statement and keep raise_error=False as default
Per code review feedback:
1. Use match statement for HTTP status code dispatch (Python 3.13)
2. Keep raise_error=False as default to avoid regression during PR stack
- Tools explicitly pass raise_error=True or use raise_error=False + raise_tool_error()
- Part 5 will flip the default after all tools are migrated
3. Update unit tests to reflect new default behavior
https://claude.ai/code/session_01MvDDV6qmWosBfGhmTLYzo8
* fix: Address code review feedback on PR #551
Fixes for HIGH priority issues:
- H1: Add `except ToolError: raise` before `except Exception` handlers in
tools_config_automations.py and tools_service.py to prevent double-wrapping
- H2: Change return type annotation to `dict[str, Any]` (NoReturn in union is meaningless)
- H3: Add case 403 to match statement for auth/permission errors
Fixes for MEDIUM priority issues:
- M2: Add `default=str` to json.dumps in raise_tool_error for non-serializable fallback
- M3: Change pytest.skip to pytest.xfail in test_lights.py to not mask regressions
https://claude.ai/code/session_01MvDDV6qmWosBfGhmTLYzo8
* test: Update 8 E2E test files to handle ToolError via safe_call_tool (#518)
Part 2 of the isError signaling fix. Updates all remaining E2E test
files that expect error responses to use safe_call_tool, which handles
both legacy dict returns and new ToolError exceptions.
Updated test files:
- test_config_entry_flow: 2 error-expecting tests
- test_helper_crud: 3 error tests + wait_for_entity_registration helper
- test_entity_management: 2 error-expecting tests
- test_file_operations: 2 helper functions using parse_mcp_result
- test_hacs: 3 error-expecting tests
- test_integration_management: 1 error-expecting test
- test_device_registry: 4 error-expecting tests
- test_voice_assistant: 2 error-expecting tests
Total: ~28 error-expecting assertions across 8 files
Depends on PR 1 which provides safe_call_tool infrastructure.
https://claude.ai/code/session_01MvDDV6qmWosBfGhmTLYzo8
* fix: Signal tool errors via isError for remaining 9 tools (#518)
Migrate remaining tool modules to use ToolError/raise_tool_error for
MCP protocol-level error signaling. Includes updated unit tests for
voice assistant and entity tools.
https://claude.ai/code/session_01MvDDV6qmWosBfGhmTLYzo8
* feat: Flip exception_to_structured_error default to raise_error=True (#518)
Now that all tools are migrated to use ToolError, flip the default
behavior of exception_to_structured_error to raise by default.
This completes the ToolError migration - all error paths now signal
errors at the MCP protocol level with isError=true.
https://claude.ai/code/session_01MvDDV6qmWosBfGhmTLYzo8
* fix: remove duplicate ToolError imports in tools_areas and test_tools_entities
Merge artifact from upstream integration — duplicate
`from fastmcp.exceptions import ToolError` lines.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments