get_device_info
Query device metadata including name, serial number, and IP address to identify and manage Moku devices on the network.
Instructions
Query device metadata (name, serial, IP, etc.)
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_device_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/moku_mcp/server.py:532-587 (handler)The actual handler logic for 'get_device_info', which queries metadata from the device.
async def get_device_info(self): """ Query device metadata (name, serial, IP, etc.). Returns: { "ip": "192.168.1.100", "name": "Lilo", "serial": "MG106B", "platform": "Moku:Go", "connected": true } Implementation: See IMPLEMENTATION_GUIDE.md Section 3.7 """ from moku import Moku if not self.moku_instance: return { "status": "error", "message": "Not connected to any device", "suggestion": "Call attach_moku first", } try: # Query via Moku API # Create a temporary Moku instance to query metadata # (We need this because MultiInstrument doesn't expose these methods directly) temp_moku = Moku(ip=self.connected_device, force_connect=False, connect_timeout=5) try: name = temp_moku.name() serial = temp_moku.serial_number() finally: # Always release ownership on the temp connection temp_moku.relinquish_ownership() info = { "ip": self.connected_device, "name": name, "serial": serial, "platform": "Moku:Go", # Inferred from platform_id=2 "connected": True, } logger.info(f"Device info: {name} ({serial}) at {self.connected_device}") return info except Exception as e: logger.error(f"Failed to query device info: {e}") return { "status": "error", "message": "Failed to query device information", "details": str(e), } - src/moku_mcp/tools.py:108-114 (registration)Registration of the 'get_device_info' tool within the MCP server.
name="get_device_info", description="Query device metadata (name, serial, IP, etc.)", inputSchema={ "type": "object", "properties": {}, }, ), - src/moku_mcp/tools.py:184-194 (handler)Tool call dispatcher for 'get_device_info'.
elif name == "get_device_info": if not server.moku_instance: error = { "status": "error", "message": "Not connected to any device", "suggestion": "Call attach_moku first", } return [TextContent(type="text", text=json.dumps(error, indent=2))] result = await server.get_device_info() return [TextContent(type="text", text=json.dumps(result, indent=2))]