get_config
Retrieve current device configuration from the Moku MCP Server to access settings and parameters for control and management.
Instructions
Retrieve current device configuration
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_config"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/moku_mcp/server.py:415-475 (handler)The implementation of the `get_config` tool handler in the `MokuMCP` server.
async def get_config(self): """ Retrieve current device configuration. Returns: { "platform": {...}, "slots": {...}, "routing": [...] } Implementation: See IMPLEMENTATION_GUIDE.md Section 3.5 """ from moku_models import MokuConfig, SlotConfig, MOKU_GO_PLATFORM if not self.moku_instance: return { "status": "error", "message": "Not connected to any device", "suggestion": "Call attach_moku first", } # If we have a cached config from push_config, use it if self.last_config: logger.info("Returning cached configuration") return self.last_config.model_dump() # Otherwise, try to reconstruct config from device state # NOTE: The Moku API may not provide full config retrieval logger.info("Reconstructing config from device state (best effort)") slots = {} # Query each slot (1-4 for Moku:Go) for slot_num in range(1, 5): try: instrument = self.moku_instance.get_instrument(slot_num) if instrument: slots[slot_num] = SlotConfig( instrument=instrument.__class__.__name__, settings={}, # TODO: Extract settings from instrument if API supports ) logger.debug(f"Slot {slot_num}: Found {instrument.__class__.__name__}") except Exception: # Slot not configured or error accessing it pass # Routing is harder to query - the Moku API doesn't provide a way to retrieve it # We can only return what we cached during push_config routing = [] if self.last_config and self.last_config.routing: routing = self.last_config.routing # Build config object platform_config = MOKU_GO_PLATFORM.model_copy( update={"ip_address": self.connected_device} ) config = MokuConfig(platform=platform_config, slots=slots, routing=routing) return config.model_dump()