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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool connects a device and returns a dictionary with status and info, but lacks details on error handling (e.g., what happens if the serial is invalid), side effects (e.g., if it locks the device for exclusive use), or performance aspects (e.g., timeouts). This is inadequate for a tool that likely involves hardware interaction.

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

Conciseness5/5

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

The description is well-structured and concise. It starts with a clear purpose statement, followed by an 'Args' section explaining the parameter, and a 'Returns' section detailing the output. Every sentence adds value without redundancy, and it's front-loaded with the core functionality.

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

Completeness3/5

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

Given the complexity (device connection tool with hardware interaction), no annotations, and an output schema (which covers return values), the description is minimally adequate. It explains the parameter and return format, but lacks behavioral details like error conditions or side effects. With output schema handling returns, it meets a baseline but could be more complete for such a critical operation.

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

Parameters4/5

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

The description adds meaningful semantics beyond the input schema. The schema has 0% description coverage and only defines 'serial' as a string with a default. The description explains that 'serial' is the device serial number and clarifies that an empty value connects to the first available device, which is crucial usage context not in the schema. With 1 parameter and low schema coverage, this compensates well.

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?

The description clearly states the tool's purpose: 'Connect to a specific PicoScope device.' It specifies the verb ('connect') and resource ('PicoScope device'), making the action clear. However, it doesn't explicitly differentiate from sibling tools like 'list_devices' or 'disconnect_device', which would require a 5.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions that an empty serial connects to the first available device, but doesn't explain when to use 'connect_device' over 'list_devices' (e.g., to check available devices first) or 'disconnect_device' (e.g., for cleanup). There's no context on prerequisites or typical workflows.

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/markuskreitzer/picoscope_mcp'

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