Skip to main content
Glama
markuskreitzer

PicoScope MCP Server

disconnect_device

Disconnect from a connected PicoScope oscilloscope device to end measurement sessions or switch instruments. Returns disconnection status confirmation.

Instructions

Disconnect from the currently connected PicoScope device.

Returns: Dictionary containing disconnection status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'disconnect_device' tool. It is decorated with @mcp.tool() and implements the disconnection logic by calling device_manager methods and returning a status dictionary.
    @mcp.tool()
    def disconnect_device() -> dict[str, Any]:
        """Disconnect from the currently connected PicoScope device.
    
        Returns:
            Dictionary containing disconnection status.
        """
        try:
            if not device_manager.is_connected():
                return {
                    "status": "warning",
                    "message": "No device was connected",
                    "connected": False,
                }
    
            success = device_manager.disconnect()
    
            if success:
                return {
                    "status": "success",
                    "message": "Device disconnected successfully",
                    "connected": False,
                }
            else:
                return {
                    "status": "error",
                    "error": "Failed to disconnect device",
                }
    
        except Exception as e:
            return {
                "status": "error",
                "error": str(e),
            }
  • The call to register_discovery_tools(mcp) in the main server file, which triggers the registration of the disconnect_device tool (along with other discovery tools).
    register_discovery_tools(mcp)
  • The underlying disconnect method in PicoScopeManager (instantiated as device_manager) that performs the actual device disconnection using PicoSDK calls.
    def disconnect(self) -> bool:
        """Disconnect from current device.
    
        Returns:
            True if disconnection successful, False otherwise.
        """
        try:
            if self.chandle:
                # Stop any running capture
                ps.ps5000aStop(self.chandle)
                # Close the unit
                ps.ps5000aCloseUnit(self.chandle)
                self.chandle = None
                self.current_device = None
                self.device_info = None
                self.channel_configs.clear()
                self.status.clear()
            return True
        except Exception as e:
            return False
  • The is_connected helper method used by the disconnect_device tool to check connection status before attempting disconnect.
    def is_connected(self) -> bool:
        """Check if a device is currently connected.
    
        Returns:
            True if connected, False otherwise.
        """
        return self.current_device is not None
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action and return format but doesn't address important behavioral aspects like whether disconnection is reversible, what happens to ongoing operations (e.g., streaming), permission requirements, or error conditions. The return format mention is helpful but insufficient for a mutation tool.

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?

The description is appropriately brief with two sentences that efficiently convey the action and return format. It's front-loaded with the core purpose, though the second sentence about returns could be integrated more smoothly. No wasted words, but minor structural improvements are possible.

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 this is a mutation tool (disconnection) with no annotations but an output schema exists, the description provides basic purpose and return format. However, it lacks sufficient behavioral context for safe use (e.g., effects on other operations, error handling), making it minimally adequate but with clear gaps in completeness.

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 tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the lack of inputs. The description appropriately doesn't add parameter information, which is correct for a parameterless tool, earning a baseline score of 4.

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 action ('Disconnect from') and resource ('currently connected PicoScope device'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'connect_device' beyond the obvious inverse relationship, which prevents a perfect score.

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

Usage Guidelines3/5

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

The description implies usage context through 'currently connected PicoScope device,' suggesting this tool should be used when a device is already connected. However, it doesn't provide explicit guidance on when to use this versus alternatives or mention any prerequisites or exclusions, leaving some ambiguity.

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