Use Guided Prompts
mcpyvisa ships with five MCP prompts — structured instruction templates that guide the LLM through common instrument workflows. Prompts are not tools. They do not execute commands directly. Instead, they provide the LLM with a step-by-step plan that references the appropriate tools, so the LLM knows what to call and in what order.
Think of prompts as domain expertise encoded into reusable scripts. They capture the knowledge of “what to do first” and “what to check when something goes wrong” so that the LLM does not have to figure it out from scratch each time.
Available prompts
Section titled “Available prompts”| Prompt | Parameters | Purpose |
|---|---|---|
bench-init | backend | Connect, discover, and summarize all instruments on a backend |
troubleshoot-bus | backend, instrument | Systematic diagnosis of a non-responsive instrument |
quick-measure | instrument, measurement_type | Configure and capture a specific type of measurement |
multi-instrument | backend | Coordinated measurements across multiple instruments |
pymeasure-guided | instrument | Validated measurement preferring pymeasure drivers |
bench-init
Section titled “bench-init”Use this when setting up a test bench for the first time or after power cycling instruments.
> Use the bench-init prompt for bench-aThe prompt instructs the LLM to:
- Call
connect_backend("bench-a")to open the connection - Call
discover_instruments("bench-a")to find all instruments and identify them - Summarize the bench: firmware version, number of instruments, their resource strings, aliases, and identities
- Flag any instruments that were discovered but failed
*IDN?
If the connection fails, the prompt includes troubleshooting guidance for both serial and TCP transports. If no instruments are found, it suggests checking cables, power, and trying interface_clear.
This prompt is a good starting point for any session. It gets the entire bench into a known state before you start working.
troubleshoot-bus
Section titled “troubleshoot-bus”Use this when a specific instrument is not responding, returning errors, or behaving unexpectedly.
> Use the troubleshoot-bus prompt for the ammeter on bench-aThe prompt walks through six escalating steps:
- Bus connectivity — Discover instruments to check if the instrument is present
- Identity — Send
*IDN?to verify the instrument can communicate - Status byte — Serial poll to check for SRQ, MAV, or error bits
- Error clearing — Send
*CLS, then readSYST:ERR?until the queue is empty - Reset — Send
*RSTand re-identify - Bus recovery — Assert
interface_clearandinstrument_clearas last resort
The LLM exits the sequence at the first step that resolves the problem. For a simple error queue overflow, it stops at step 4. For a completely hung bus, it goes through all six.
quick-measure
Section titled “quick-measure”Use this when you want to take a specific type of measurement and need the LLM to handle instrument configuration, triggering, and validation.
> Use the quick-measure prompt for dc_voltage on the DMMThe prompt guides the LLM through:
- Identify the instrument — Call
*IDN?to determine the model and adapt commands accordingly - Configure — Send the appropriate
CONF:*command for the measurement type (DC voltage, AC voltage, frequency, resistance, current) - Trigger and read — Choose between
READ?for simple measurements orINIT/FETCH?for triggered acquisition - Validate — Check
*STB?to verify the reading completed without error
Supported measurement_type values include dc_voltage, ac_voltage, frequency, resistance, 4wire_resistance, dc_current, and ac_current. The prompt provides the corresponding SCPI subsystem commands for each.
multi-instrument
Section titled “multi-instrument”Use this for coordinated measurements across multiple instruments on the same backend, or for a periodic infrastructure audit.
> Use the multi-instrument prompt for bench-aThe prompt operates across all instruments on the specified backend:
- Status check — Call
server_statusto show connected backends and instruments - For each connected backend — Discover instruments, check SRQ, serial poll all instruments
- Coordinated reads — Take measurements from multiple instruments in sequence or with bus triggers
- Generate a report — Total backends, total instruments, any SRQ assertions, any error statuses, and recommendations
This is useful at the start of a workday to verify that everything is online, or after a power event to assess what survived.
pymeasure-guided
Section titled “pymeasure-guided”Use this when you want the best available measurement approach — validated pymeasure control if a driver exists, raw SCPI if not.
> Use the pymeasure-guided prompt for the DMMThe prompt first calls instrument_inspect to check for a pymeasure driver. If one exists (8 instruments are supported), it guides the LLM through:
- Inspect — Discover validated properties and methods
- Check state — Read key control properties to understand current configuration
- Configure — Set properties with validation, or call high-level methods
- Measure — Read measurement properties (pymeasure handles SCPI and parsing)
- Cleanup — Disable outputs, return to local control
If no driver exists, the prompt falls back to raw SCPI (instrument_query / instrument_write).
How prompts work in MCP
Section titled “How prompts work in MCP”MCP prompts are part of the Model Context Protocol specification. When an MCP client (like Claude Code) supports prompts, it can:
- List available prompts with
list_prompts - Retrieve a prompt’s content with
get_prompt, passing the required parameters - Inject the resulting text into the conversation as context for the LLM
The LLM then follows the instructions in the prompt text, calling the appropriate mcpyvisa tools to carry out each step. The prompt itself does not execute anything — it provides a plan that the LLM executes.
Not all MCP clients support prompts yet. If yours does not, you can achieve the same result by describing the workflow to the LLM directly. The prompt text is documented in the mcpyvisa source code in prompts.py if you want to use it as a reference for manual instructions.