list_devices
Discover all connected Bond Bridge smart home devices to manage ceiling fans, motorized shades, dimmable lights, and RF-controlled devices through comprehensive device listing.
Instructions
List all Bond devices connected to the bridge.
Returns: Dictionary containing all devices with their basic information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/bond_mcp/server.py:40-71 (handler)MCP tool handler for 'list_devices' using FastMCP @mcp.tool() decorator. Lists Bond Bridge devices, transforms API response for readability, and handles BondAPIError and general exceptions.@mcp.tool() async def list_devices() -> Dict[str, Any]: """List all Bond devices connected to the bridge. Returns: Dictionary containing all devices with their basic information. """ try: async with await get_bond_client() as client: devices_data = await client.list_devices() # Transform the data for better readability devices = {} for device_id, device_info in devices_data.items(): if not device_id.startswith('_'): # Skip metadata devices[device_id] = { "id": device_id, "name": device_info.get("name", "Unknown"), "type": device_info.get("type", "Unknown"), "location": device_info.get("location", "") } return { "devices": devices, "total_count": len(devices) } except BondAPIError as e: return {"error": f"Failed to list devices: {str(e)}"} except Exception as e: logger.error(f"Unexpected error listing devices: {e}") return {"error": f"Unexpected error: {str(e)}"}
- src/bond_mcp/bond_client.py:104-106 (helper)BondClient helper method that performs the HTTP GET request to the Bond Bridge API endpoint '/v2/devices' to retrieve the list of devices.async def list_devices(self) -> Dict[str, Any]: """List all devices connected to the Bond Bridge.""" return await self._request("GET", "devices")
- src/bond_mcp/bond_client.py:53-54 (helper)Underlying _request method in BondClient used by list_devices to make authenticated HTTP requests to the Bond Bridge API, with error handling and logging.async def _request(self, method: str, endpoint: str, **kwargs) -> Dict[str, Any]: """Make HTTP request to Bond API.
- src/bond_mcp/server.py:31-38 (helper)Factory function to create BondClient instance from configuration, used as context manager in the list_devices handler.async def get_bond_client() -> BondClient: """Get configured Bond client.""" return BondClient( host=config.bond_host, token=config.bond_token, timeout=config.timeout )