list_devices
Retrieve all connected Bond Bridge smart home devices to manage ceiling fans, shades, lights, and other RF-controlled equipment.
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'. Uses FastMCP @mcp.tool() decorator for registration. Fetches devices via BondClient, filters metadata, transforms to simplified structure with id, name, type, location, and returns count.@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 implementing the core API call: HTTP GET to Bond Bridge /v2/devices endpoint to retrieve raw device data.async def list_devices(self) -> Dict[str, Any]: """List all devices connected to the Bond Bridge.""" return await self._request("GET", "devices")