Skip to main content
Glama
markuskreitzer

PicoScope MCP Server

connect_device

Establish connection to a PicoScope oscilloscope device for signal acquisition and analysis. Specify a serial number or connect to the first available device to enable measurement and data capture functionality.

Instructions

Connect to a specific PicoScope device.

Args: serial: Device serial number. If empty, connects to first available device.

Returns: Dictionary containing connection status and device information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serialNo

Implementation Reference

  • The handler function for the 'connect_device' MCP tool. Connects to a PicoScope device by serial (or first available), retrieves info via device_manager, and returns success/error status with device details.
    @mcp.tool()
    def connect_device(serial: str = "") -> dict[str, Any]:
        """Connect to a specific PicoScope device.
    
        Args:
            serial: Device serial number. If empty, connects to first available device.
    
        Returns:
            Dictionary containing connection status and device information.
        """
        try:
            # Connect to device
            success = device_manager.connect(serial=serial if serial else None)
    
            if not success:
                return {
                    "status": "error",
                    "error": "Failed to connect to device",
                    "serial": serial,
                }
    
            # Get device info
            info = device_manager.get_info()
            if info:
                return {
                    "status": "success",
                    "connected": True,
                    "device": {
                        "model": info.model,
                        "serial": info.serial,
                        "variant": info.variant,
                        "num_channels": info.num_channels,
                        "max_adc_value": info.max_adc_value,
                    },
                }
            else:
                return {
                    "status": "error",
                    "error": "Connected but failed to retrieve device info",
                }
    
        except Exception as e:
            return {
                "status": "error",
                "error": str(e),
                "serial": serial,
            }
  • Registers the discovery tools (including connect_device) by calling register_discovery_tools on the MCP server instance.
    register_discovery_tools(mcp)
  • Imports the register_discovery_tools function used to register connect_device and other discovery tools.
    from .tools.discovery import register_discovery_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/markuskreitzer/picoscope_mcp'

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