get_connected_devices
Identify and list all connected USB devices and paired Bluetooth devices to troubleshoot peripheral issues and maintain device inventory.
Instructions
Get USB and Bluetooth device information.
Lists all connected USB devices and paired/active Bluetooth devices. Useful for peripheral troubleshooting and device inventory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/sysinfo/server.py:133-149 (handler)The primary tool handler for 'get_connected_devices'. Decorated with @mcp.tool for registration. Fetches device info via get_connectivity_devices() helper, formats with timestamp/header, and returns as ToolResult text content.@mcp.tool def get_connected_devices() -> ToolResult: """Get USB and Bluetooth device information. Lists all connected USB devices and paired/active Bluetooth devices. Useful for peripheral troubleshooting and device inventory. """ info_sections = [] info_sections.append("# Connected Devices") info_sections.append(f"*Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*\n") try: info_sections.extend(get_connectivity_devices()) except Exception as e: info_sections.append(f"⚠️ **Device detection error**: {str(e)}") return text_response("\n".join(info_sections))
- src/sysinfo/collectors.py:798-814 (helper)Core helper function implementing the device collection logic. Combines USB devices (via get_usb_devices()) and Bluetooth devices (via get_bluetooth_devices()), formats as markdown list.def get_connectivity_devices() -> List[str]: """Get USB and Bluetooth device information""" info = [] info.append("## 🔌 Connected Devices") # USB devices usb_info = get_usb_devices() if len(usb_info) > 1: # More than just the header info.extend(usb_info) # Bluetooth devices bt_info = get_bluetooth_devices() if len(bt_info) > 1: # More than just the header info.append("") # Add spacing info.extend(bt_info) return info