Skip to content

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.


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

NameTypeRequiredDescription
backendstringYesName of the backend to initialize

Workflow

  1. Call connect_backend to establish communication
  2. Call discover_instruments to find instruments on the bus
  3. Note each instrument’s VISA address and identity
  4. 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"
})

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

NameTypeRequiredDescription
backendstringYesName of the backend
instrumentstringNoVISA resource string or alias of the problematic instrument. If omitted, diagnoses the entire bus

Workflow

  1. Verify bus connectivitydiscover_instruments to check if the instrument appears
  2. Check identityinstrument_identify to test *IDN? support
  3. Check statusserial_poll to read the status byte (RQS, ESB, MAV bits)
  4. Clear error state — Send *CLS via instrument_write, then loop SYST:ERR? via instrument_query until 0,No error
  5. Reset if neededinstrument_reset followed by re-identification
  6. Bus-level recoveryinterface_clear and instrument_clear as 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 instrument
prompt = await client.get_prompt("troubleshoot-bus", {
"backend": "bench-a",
"instrument": "dmm"
})
# Diagnose the entire bus
prompt = await client.get_prompt("troubleshoot-bus", {
"backend": "bench-a"
})

Guide setup and capture of a specific measurement type. Covers instrument identification, configuration, triggering, reading, and validation.

Parameters

NameTypeRequiredDescription
instrumentstringYesVISA resource string or alias of the measurement instrument
quantitystringYesType of measurement (e.g., dc_voltage, frequency, resistance, ac_voltage, current_dc, 4wire_resistance)

Workflow

  1. Identify the instrument — determine model and available SCPI commands
  2. Configure the measurement — send CONF:* commands appropriate to the measurement type and instrument model
  3. Trigger and read — either READ? for single-shot or the INIT / FETCH? pattern for triggered measurements
  4. Validate — check the returned value and instrument status byte

Includes a table of common SCPI configuration commands mapped to measurement types:

TypeSCPI Pattern
DC VoltageCONF:VOLT:DC [range],[resolution]
AC VoltageCONF:VOLT:AC [range],[resolution]
FrequencyCONF:FREQ [range],[resolution]
ResistanceCONF:RES [range],[resolution]
4-Wire ResistanceCONF:FRES [range],[resolution]
DC CurrentCONF: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"
})

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

NameTypeRequiredDescription
instrumentsstringYesComma-separated instrument aliases or VISA resource strings

Workflow

  1. Identify all instruments — call instrument_identify on each
  2. Determine roles — classify instruments as sources, meters, or both based on model identification
  3. Configure sources first — set voltage/current ranges, compliance limits
  4. Enable outputs — turn on source outputs in safe order
  5. Read measurements — query meter instruments for readings
  6. 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"
})

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

NameTypeRequiredDescription
instrumentstringYesVISA resource string or alias of the instrument

Workflow

  1. Discover capabilities — Call instrument_inspect to find the pymeasure driver. If no driver exists, skip to step 5 (raw SCPI fallback)
  2. Check current state — Use instrument_get to read key control properties (source mode, enabled state, compliance settings, measurement function)
  3. Configure the measurement — Use instrument_set for validated properties, or instrument_call for high-level methods like apply_voltage(voltage=5.0, compliance_current=0.1)
  4. Read the measurement — Use instrument_get on measurement properties. pymeasure handles SCPI commands, response parsing, and type conversion
  5. Raw SCPI fallback — If no pymeasure driver exists, use instrument_query and instrument_write directly
  6. Cleanup — Disable outputs via instrument_call("shutdown"), return to local control via instrument_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"
})