Skip to main content
Glama
markuskreitzer

PicoScope MCP Server

measure_frequency

Measure signal frequency on PicoScope oscilloscope channels after capturing data. Use this tool to analyze waveforms and obtain frequency measurements in Hz.

Instructions

Measure signal frequency on a channel.

Note: This requires a recent capture. Call capture_block first.

Args: channel: Channel to measure.

Returns: Dictionary containing frequency in Hz and measurement details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes

Implementation Reference

  • The core handler function for the 'measure_frequency' tool, decorated with @mcp.tool(). It checks device connection and channel configuration, currently returns guidance on usage as implementation is stubbed pending capture data.
    @mcp.tool()
    def measure_frequency(channel: Literal["A", "B", "C", "D"]) -> dict[str, Any]:
        """Measure signal frequency on a channel.
    
        Note: This requires a recent capture. Call capture_block first.
    
        Args:
            channel: Channel to measure.
    
        Returns:
            Dictionary containing frequency in Hz and measurement details.
        """
        try:
            if not device_manager.is_connected():
                return {
                    "status": "error",
                    "error": "No device connected",
                }
    
            # Check if channel is configured
            if channel not in device_manager.channel_configs:
                return {
                    "status": "error",
                    "error": f"Channel {channel} not configured. Configure and capture first.",
                }
    
            # For now, we need to guide the user to capture data first
            # In a real implementation, we might store the last capture
            return {
                "status": "info",
                "message": "To measure frequency: 1) Configure channel, 2) Set trigger, 3) Capture block, then extract frequency from captured data",
                "channel": channel,
            }
    
        except Exception as e:
            return {
                "status": "error",
                "error": str(e),
                "channel": channel,
            }
  • Top-level registration call to register_analysis_tools(mcp), which defines and registers the measure_frequency tool using nested @mcp.tool() decorators.
    register_analysis_tools(mcp)
  • The registration function that contains the @mcp.tool() decorated measure_frequency handler and other analysis tools.
    def register_analysis_tools(mcp: Any) -> None:
        """Register signal analysis tools with the MCP server."""
  • Helper function imported but not yet used in measure_frequency, intended for frequency calculation from time and voltage arrays.
    def calculate_frequency(time_values: np.ndarray, voltage_values: np.ndarray) -> float:

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