get_device_list
Retrieve a list of all connected LG ThinQ devices to view and manage your smart home inventory.
Instructions
Retrieves a list of all devices connected to the ThinQ Connect platform Args: None
Returns:
String containing connected device list information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- thinqconnect_mcp/server.py:64-75 (handler)MCP handler function for the 'get_device_list' tool, registered with @mcp.tool decorator. It takes no arguments and returns a formatted string of devices by delegating to the tools module helper.@mcp.tool( description="""Retrieves a list of all devices connected to the ThinQ Connect platform Args: None Returns: String containing connected device list information """ ) async def get_device_list() -> str: return await tools.get_device_list(thinq_api=thinq_api)
- thinqconnect_mcp/tools.py:84-109 (helper)Supporting helper function that implements the core logic: initializes session, caches and retrieves device list from ThinQApi, formats into a human-readable string with device details.async def get_device_list(thinq_api: ThinQApi) -> List[str]: """ Get device list """ global local_device_lists try: thinq_api._session = ClientSession() if not local_device_lists: devices = await thinq_api.async_get_device_list() local_device_lists = devices else: devices = local_device_lists device_info = [] for device in devices: device_info.append( f"Device ID: {device.get('deviceId')}\n" f"Device Name: {device.get('deviceInfo').get('alias')}\n" f"Device Type: {device.get('deviceInfo').get('deviceType')}\n" f"Model Name: {device.get('deviceInfo').get('modelName')}\n" ) header = f"Found {len(devices)} devices:\n\n" return header + "\n".join(device_info) except Exception as e: return f"An error occurred while retrieving device list: {str(e)}"