Skip to main content
Glama
sealablab

Moku MCP Server

by sealablab

push_config

Deploy configuration settings to connected Moku devices for network management and signal routing control.

Instructions

Deploy MokuConfig to connected device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
config_dictYesMokuConfig serialized as dict

Implementation Reference

  • The push_config method handles the deployment of MokuConfig to the connected device by configuring instrument slots and setting up signal routing.
    async def push_config(self, config_dict: dict):
        """
        Deploy MokuConfig to connected device.
    
        Args:
            config_dict: MokuConfig serialized as dict
    
        Returns:
            {
                "status": "deployed",
                "slots_configured": [1, 2],
                "routing_configured": True
            }
    
        Implementation: See IMPLEMENTATION_GUIDE.md Section 3.4
        """
        from moku.instruments import CloudCompile, Oscilloscope
        from pydantic import ValidationError
    
        if not self.moku_instance:
            return {
                "status": "error",
                "message": "Not connected to any device",
                "suggestion": "Call attach_moku first",
            }
    
        # Validate and parse config
        try:
            config = MokuConfig.model_validate(config_dict)
        except ValidationError as e:
            logger.error(f"Invalid config: {e}")
            return {"status": "error", "message": "Invalid MokuConfig", "errors": e.errors()}
    
        # Validate routing
        errors = config.validate_routing()
        if errors:
            return {
                "status": "error",
                "message": "Invalid routing configuration",
                "errors": errors,
            }
    
        deployed_slots = []
    
        # Deploy instruments to slots
        for slot_num, slot_config in config.slots.items():
            try:
                if slot_config.instrument == "CloudCompile":
                    if not slot_config.bitstream:
                        logger.warning(f"Slot {slot_num}: No bitstream specified")
                        continue
    
                    logger.info(f"Deploying CloudCompile to slot {slot_num}")
                    self.moku_instance.set_instrument(
                        slot_num, CloudCompile, bitstream=slot_config.bitstream
                    )
    
                    # Apply control registers if specified
                    if slot_config.control_registers:
                        cc = self.moku_instance.get_instrument(slot_num)
                        for reg, value in slot_config.control_registers.items():
                            cc.write_register(reg, value)
                            logger.debug(f"Slot {slot_num}: Set register {reg} = {value:#x}")
    
                    deployed_slots.append(slot_num)
                    logger.info(f"Successfully deployed CloudCompile to slot {slot_num}")
    
                elif slot_config.instrument == "Oscilloscope":
                    logger.info(f"Deploying Oscilloscope to slot {slot_num}")
                    osc = self.moku_instance.set_instrument(slot_num, Oscilloscope)
    
                    # Apply settings if specified
                    if slot_config.settings and "timebase" in slot_config.settings:
                        osc.set_timebase(*slot_config.settings["timebase"])
                        logger.debug(f"Slot {slot_num}: Set timebase {slot_config.settings['timebase']}")
    
                    deployed_slots.append(slot_num)
                    logger.info(f"Successfully deployed Oscilloscope to slot {slot_num}")
    
                else:
                    logger.warning(
                        f"Slot {slot_num}: Instrument '{slot_config.instrument}' not supported yet"
                    )
    
            except Exception as e:
                logger.error(f"Failed to deploy slot {slot_num}: {e}")
                return {
                    "status": "error",
                    "message": f"Failed to deploy instrument to slot {slot_num}",
                    "details": str(e),
                    "slots_deployed": deployed_slots,
                }
    
        # Configure routing
        routing_configured = False
        if config.routing:
            try:
                # Convert routing to dict format expected by Moku API
                connections = []
                for conn in config.routing:
                    connections.append(
                        {"source": conn.source, "destination": conn.destination}
                    )
    
                self.moku_instance.set_connections(connections)
                routing_configured = True
                logger.info(f"Configured {len(connections)} routing connections")
    
            except Exception as e:
                logger.error(f"Failed to configure routing: {e}")
                return {
                    "status": "partial_success",
                    "message": "Instruments deployed but routing failed",
                    "slots_configured": deployed_slots,
                    "routing_error": str(e),
                }
    
        # Cache the config for get_config()
        self.last_config = config
    
        return {
            "status": "deployed",
            "slots_configured": deployed_slots,
            "routing_configured": routing_configured,
        }
  • The tools.py file registers and dispatches the push_config tool call to the server's push_config method.
    elif name == "push_config":
        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.push_config(**arguments)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. 'Deploy' implies a write operation but doesn't disclose atomicity, validation behavior, error handling, or whether this overwrites existing device state. For a configuration deployment tool, this lack of behavioral context is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely terse (6 words) but efficient. No wasted words, though the brevity borders on under-specification given the complexity of hardware configuration deployment. Front-loaded structure is appropriate.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Inadequate for a deployment tool with nested object parameters and no output schema. Missing: prerequisites for device connection, success/failure indicators, relationship to get_config (inverse operation), and whether deployment is immediate or requires subsequent activation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing baseline 3. The description doesn't add parameter semantics beyond the schema (which already describes config_dict as 'MokuConfig serialized as dict'), nor does it provide examples, constraints, or format details for the nested object structure.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb ('Deploy') and resource ('MokuConfig'), with explicit target ('connected device'). However, it fails to distinguish from sibling get_config (which presumably retrieves config), leaving the bidirectional relationship implicit rather than explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides no guidance on when to use versus alternatives (e.g., set_routing for partial changes), nor prerequisites (e.g., whether attach_moku must be called first). The description assumes the agent already knows the workflow.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sealablab/moku-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server