get_device_state
Retrieve the current operational status of a Bond Bridge smart home device, including power state, speed, direction, and other real-time parameters.
Instructions
Get current state of a Bond device.
Args: device_id: The Bond device identifier
Returns: Current device state including power, speed, direction, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | Yes |
Implementation Reference
- src/bond_mcp/server.py:97-118 (handler)MCP tool handler for get_device_state: fetches and returns the current state of the specified Bond device.@mcp.tool() async def get_device_state(device_id: str) -> Dict[str, Any]: """Get current state of a Bond device. Args: device_id: The Bond device identifier Returns: Current device state including power, speed, direction, etc. """ try: async with await get_bond_client() as client: state = await client.get_device_state(device_id) return { "device_id": device_id, "state": state } except BondAPIError as e: return {"error": f"Failed to get device state: {str(e)}"} except Exception as e: logger.error(f"Unexpected error getting device state: {e}") return {"error": f"Unexpected error: {str(e)}"}
- src/bond_mcp/bond_client.py:119-128 (helper)BondClient helper method that makes the HTTP GET request to the Bond API endpoint for the device's state.async def get_device_state(self, device_id: str) -> Dict[str, Any]: """Get current state of a device. Args: device_id: Device identifier Returns: Device state """ return await self._request("GET", f"devices/{device_id}/state")