mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-23 05:54:19 +02:00
fix phue2 import in smart_home example (#2999)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
This commit is contained in:
parent
311e173b99
commit
5da65096fc
3 changed files with 6 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from mcp.types import ToolAnnotations
|
||||
from phue2 import Bridge
|
||||
from phue import Bridge
|
||||
|
||||
from fastmcp import FastMCP
|
||||
from smart_home.lights.server import lights_mcp
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from typing import Any
|
||||
|
||||
from phue2 import Bridge
|
||||
from phue2.exceptions import PhueException
|
||||
from phue import Bridge
|
||||
from phue.exceptions import PhueException
|
||||
|
||||
from smart_home.settings import settings
|
||||
|
||||
|
|
@ -23,12 +23,12 @@ def _get_bridge() -> Bridge | None:
|
|||
def handle_phue_error(
|
||||
light_or_group: str, operation: str, error: Exception
|
||||
) -> dict[str, Any]:
|
||||
"""Creates a standardized error response for phue2 operations."""
|
||||
"""Creates a standardized error response for phue operations."""
|
||||
base_info = {"target": light_or_group, "operation": operation, "success": False}
|
||||
if isinstance(error, KeyError):
|
||||
base_info["error"] = f"Target '{light_or_group}' not found"
|
||||
elif isinstance(error, PhueException):
|
||||
base_info["error"] = f"phue2 error during {operation}: {error}"
|
||||
base_info["error"] = f"phue error during {operation}: {error}"
|
||||
else:
|
||||
base_info["error"] = f"Unexpected error during {operation}: {error}"
|
||||
return base_info
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
from typing import Annotated, Any, Literal, TypedDict
|
||||
|
||||
from mcp.types import ToolAnnotations
|
||||
from phue2.exceptions import PhueException
|
||||
from phue.exceptions import PhueException
|
||||
from pydantic import Field
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue