get_device_list
Retrieve all devices connected to the ThinQ Connect platform, returning a list with device information.
Instructions
Retrieves a list of all devices connected to the ThinQ Connect platform Args: None
Returns:
String containing connected device list informationInput Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- thinqconnect_mcp/server.py:64-74 (registration)The `@mcp.tool` decorator registers 'get_device_list' as an MCP tool. The async function delegates to `tools.get_device_list(thinq_api=thinq_api)`.
@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-108 (handler)Core handler logic for `get_device_list`. Creates a ClientSession, fetches the device list via `thinq_api.async_get_device_list()`, caches it in `local_device_lists`, and formats a human-readable string with device ID, name, type, and model for each device.
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)}"