measure_frequency
Measure signal frequency on oscilloscope channels to analyze waveform characteristics and timing parameters for electronic testing and debugging.
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
| Name | Required | Description | Default |
|---|---|---|---|
| channel | Yes |
Implementation Reference
- The core handler function for the 'measure_frequency' tool, decorated with @mcp.tool() for automatic registration. Handles channel validation, device connection checks, and provides guidance for usage (currently a placeholder implementation). Defines input schema via type hints.@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, }
- src/picoscope_mcp/server.py:18-18 (registration)Explicit registration call that invokes the analysis tools registration, which includes the measure_frequency tool.register_analysis_tools(mcp)
- src/picoscope_mcp/server.py:8-8 (registration)Import of the registration function for analysis tools containing measure_frequency.from .tools.analysis import register_analysis_tools