Prompts
mcpyvisa provides 5 MCP prompts that encode domain knowledge about instrument initialization, troubleshooting, and measurement workflows. Prompts return structured step-by-step instructions that guide the LLM through multi-tool sequences, including fallback strategies for common failure modes.
bench-init
Section titled “bench-init”Connect to a backend, scan the bus, and identify all instruments. Use this when setting up a test bench for the first time or after power cycling instruments.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
backend | string | Yes | Name of the backend to initialize |
Workflow
- Call
connect_backendto establish communication - Call
discover_instrumentsto find instruments on the bus - Note each instrument’s VISA address and identity
- Summarize the bench setup (backend type, instrument count, unidentified addresses)
Includes troubleshooting guidance for:
- AR488 serial transport connection failures (USB cable, port permissions)
- AR488 TCP transport connection failures (WiFi, IP address, single-client limit)
- pyvisa-py backend issues (missing dependencies, device permissions)
- Empty instrument scans (cable issues, instrument power, bus reset via
interface_clear)
When to use
At the start of any session, or after instruments have been added, removed, or power cycled.
Example
prompt = await client.get_prompt("bench-init", { "backend": "bench-a"})troubleshoot-bus
Section titled “troubleshoot-bus”Systematic diagnostic sequence for a non-responsive instrument or bus. Walks through bus connectivity, identification, status polling, error clearing, reset, and bus-level recovery.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
backend | string | Yes | Name of the backend |
instrument | string | No | VISA resource string or alias of the problematic instrument. If omitted, diagnoses the entire bus |
Workflow
- Verify bus connectivity —
discover_instrumentsto check if the instrument appears - Check identity —
instrument_identifyto test*IDN?support - Check status —
serial_pollto read the status byte (RQS, ESB, MAV bits) - Clear error state — Send
*CLSviainstrument_write, then loopSYST:ERR?viainstrument_queryuntil0,No error - Reset if needed —
instrument_resetfollowed by re-identification - Bus-level recovery —
interface_clearandinstrument_clearas last resort
When to use
When an instrument stops responding to commands, returns unexpected data, or was working previously but has become unreliable.
Example
# Troubleshoot a specific instrumentprompt = await client.get_prompt("troubleshoot-bus", { "backend": "bench-a", "instrument": "dmm"})
# Diagnose the entire busprompt = await client.get_prompt("troubleshoot-bus", { "backend": "bench-a"})quick-measure
Section titled “quick-measure”Guide setup and capture of a specific measurement type. Covers instrument identification, configuration, triggering, reading, and validation.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
instrument | string | Yes | VISA resource string or alias of the measurement instrument |
quantity | string | Yes | Type of measurement (e.g., dc_voltage, frequency, resistance, ac_voltage, current_dc, 4wire_resistance) |
Workflow
- Identify the instrument — determine model and available SCPI commands
- Configure the measurement — send
CONF:*commands appropriate to the measurement type and instrument model - Trigger and read — either
READ?for single-shot or theINIT/FETCH?pattern for triggered measurements - Validate — check the returned value and instrument status byte
Includes a table of common SCPI configuration commands mapped to measurement types:
| Type | SCPI Pattern |
|---|---|
| DC Voltage | CONF:VOLT:DC [range],[resolution] |
| AC Voltage | CONF:VOLT:AC [range],[resolution] |
| Frequency | CONF:FREQ [range],[resolution] |
| Resistance | CONF:RES [range],[resolution] |
| 4-Wire Resistance | CONF:FRES [range],[resolution] |
| DC Current | CONF:CURR:DC [range],[resolution] |
When to use
When you need to take a specific measurement and want guidance on the correct command sequence for the instrument at hand.
Example
prompt = await client.get_prompt("quick-measure", { "instrument": "dmm", "quantity": "dc_voltage"})multi-instrument
Section titled “multi-instrument”Coordinate measurements across multiple instruments. This prompt handles the sequencing logic for multi-instrument setups — configuring source instruments, waiting for settling, then reading measurement instruments.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
instruments | string | Yes | Comma-separated instrument aliases or VISA resource strings |
Workflow
- Identify all instruments — call
instrument_identifyon each - Determine roles — classify instruments as sources, meters, or both based on model identification
- Configure sources first — set voltage/current ranges, compliance limits
- Enable outputs — turn on source outputs in safe order
- Read measurements — query meter instruments for readings
- Cleanup — disable sources and return instruments to local control
When to use
When a test requires coordinating multiple instruments — for example, sourcing a voltage from a Keithley 2400 while measuring current on a separate DMM, or sweeping a signal generator while reading a power meter.
Example
prompt = await client.get_prompt("multi-instrument", { "instruments": "smu,dmm"})pymeasure-guided
Section titled “pymeasure-guided”Guided workflow that steers toward validated pymeasure tools when a driver is available, falling back to raw SCPI when necessary. This prompt is only registered when pymeasure is installed.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
instrument | string | Yes | VISA resource string or alias of the instrument |
Workflow
- Discover capabilities — Call
instrument_inspectto find the pymeasure driver. If no driver exists, skip to step 5 (raw SCPI fallback) - Check current state — Use
instrument_getto read key control properties (source mode, enabled state, compliance settings, measurement function) - Configure the measurement — Use
instrument_setfor validated properties, orinstrument_callfor high-level methods likeapply_voltage(voltage=5.0, compliance_current=0.1) - Read the measurement — Use
instrument_geton measurement properties. pymeasure handles SCPI commands, response parsing, and type conversion - Raw SCPI fallback — If no pymeasure driver exists, use
instrument_queryandinstrument_writedirectly - Cleanup — Disable outputs via
instrument_call("shutdown"), return to local control viainstrument_local
When to use
When you want the best available measurement approach for an instrument — validated pymeasure control if a driver exists, raw SCPI otherwise. This prompt automates the decision that you would otherwise make by checking instrument_inspect first.
Example
prompt = await client.get_prompt("pymeasure-guided", { "instrument": "smu"})