Skip to main content
Glama
madorn
by madorn

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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)}"}
  • 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")
  • 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.
  • 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
        )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/madorn/bond-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server