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
|`readOnlyHint: True`|`False`| Tool does not modify its environment|
618
+
|`destructiveHint: True`|`True`| Tool may perform destructive updates (only meaningful when `readOnlyHint` is false). Set to `False` for non-destructive writes (e.g., creating a record)|
619
+
|`idempotentHint: True`|`False`| Repeated calls with same args have no additional effect (only meaningful when `readOnlyHint` is false)|
606
620
607
621
### Error Handling
608
-
Use structured errors from `errors.py`:
622
+
623
+
**Always use the dedicated error functions** from `errors.py` and `helpers.py`. Never construct raw error dicts manually — the helpers ensure consistent structure, error codes, and suggestions across all tools.
624
+
625
+
**Domain-specific errors** (`errors.py`) — use these when the error type is known:
609
626
```python
610
-
from ..errors import create_error_response, ErrorCode
611
-
return create_error_response(
612
-
code=ErrorCode.ENTITY_NOT_FOUND,
613
-
message="Entity not found",
614
-
suggestions=["Use ha_search_entities() to find valid IDs"]
615
-
)
627
+
from ..errors import create_entity_not_found_error, create_validation_error, create_service_error
Available helpers: `create_entity_not_found_error`, `create_connection_error`, `create_auth_error`, `create_service_error`, `create_validation_error`, `create_config_error`, `create_timeout_error`, `create_resource_not_found_error`, and the generic `create_error_response`.
640
+
641
+
**Catch-all exception handler** (`helpers.py`) — use in `except Exception` blocks:
642
+
```python
643
+
from .helpers import exception_to_structured_error
**Pattern for tools**: Use `exception_to_structured_error` as the catch-all — it already classifies 404s, auth errors, timeouts, etc. based on exception type and message. Pass `context={"entity_id": ...}` so it can produce `ENTITY_NOT_FOUND` for 404 errors automatically. No manual 404 string matching needed:
On every commit, a `pre-commit` hook runs `ruff check --fix` to auto-fix and catch lint violations. The **Ruff Lint** CI job also enforces this on pull requests.
35
+
32
36
## 📋 Guidelines
33
37
34
38
-**Code**: Follow existing patterns, add type hints, test new features
-**[@kingbear2](https://github.com/kingbear2)** — Windows UV setup guide.
197
-
-**[@sergeykad](https://github.com/sergeykad)** — Dashboard card-level CRUD operations, better changelogs and removed the dependency to textdistance/numpy.
198
-
-**[@konradwalsh](https://github.com/konradwalsh)** — Financial support via [GitHub Sponsors](https://github.com/sponsors/julienld). Thank you! ☕
-**[@kingbear2](https://github.com/kingbear2)** — Windows UV setup guide.
210
+
-**[@konradwalsh](https://github.com/konradwalsh)** — Financial support via [GitHub Sponsors](https://github.com/sponsors/julienld). Thank you! ☕
0 commit comments