Use Guided Prompts
mcgpib ships with five MCP prompts — structured instruction templates that guide the LLM through common GPIB 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 |
|---|---|---|
initialize_bench | bridge_name | Connect, scan, and summarize all instruments on a bridge |
troubleshoot_instrument | bridge_name, address | Systematic diagnosis of a non-responsive instrument |
measurement_sequence | bridge_name, address, measurement_type | Configure and capture a specific type of measurement |
bus_health_check | (none) | Full infrastructure audit across all bridges |
scpi_command_help | instrument_model | Look up SCPI commands for a specific instrument model |
initialize_bench
Section titled “initialize_bench”Use this when setting up a test bench for the first time or after power cycling instruments.
> Use the initialize_bench prompt for bench-aThe prompt instructs the LLM to:
- Call
connect_bridge("bench-a")to open the serial or TCP connection - Call
bus_scan("bench-a")to discover all listeners and identify them - Summarize the bench: firmware version, number of instruments, their addresses and identities
- Flag any addresses that responded to
findlstnbut 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_instrument
Section titled “troubleshoot_instrument”Use this when a specific instrument is not responding, returning errors, or behaving unexpectedly.
> Use the troubleshoot_instrument prompt for address 5 on bench-aThe prompt walks through six escalating steps:
- Bus connectivity — Scan to check if the address 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_clearandbus_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.
measurement_sequence
Section titled “measurement_sequence”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 measurement_sequence prompt for dc_voltage on address 1, bench-aThe 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.
bus_health_check
Section titled “bus_health_check”Use this for a periodic infrastructure audit, or when you are not sure which bridges are connected and what instruments are available.
> Run a bus health checkThe prompt has no parameters — it operates across all configured bridges:
- List bridges — Show which are connected and which are disconnected
- For each connected bridge — Scan the bus, check SRQ, serial poll all instruments
- For each disconnected bridge — Attempt to connect and log the result
- Generate a report — Total bridges, 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.
scpi_command_help
Section titled “scpi_command_help”Use this when you need to know the correct commands for a specific instrument model.
> Use the scpi_command_help prompt for HP3478AThe prompt asks the LLM to provide:
- Measurement commands —
CONF:*,SENS:*,TRIG:*,READ?,FETCH?,MEAS:* - Status and error handling — Status byte bit assignments,
SYST:ERR?,*ESE,*ESR? - Important notes — Whether the instrument is IEEE 488.2 compliant, non-standard behavior, typical timeout requirements, power-on initialization needs
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 mcgpib 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 mcgpib source code in prompts.py if you want to use it as a reference for manual instructions.