MCP tool reference

From SweepMe! Wiki
Jump to navigation Jump to search

This page describes the tools of the SweepMe! MCP server in SweepMe! 1.6.1.7. AI applications read these descriptions automatically, so you do not need them to use SweepMe! with AI. They help to understand what an assistant can do and to write your own MCP clients. How to connect an AI application is described in AI applications.

Typical workflow

  1. load_sequence: load the sequence file of your measurement.
  2. set_folder and set_filename: choose where the data will be saved. Loading a sequence restores the folder and file name stored in it, so set them after loading.
  3. start_run: start the measurement. The tool returns immediately.
  4. wait_for_completion: wait until the run has finished.
  5. get_all_measurement_values or get_measurement_value: read the latest values, or read the saved data file (see Loading data files).

The server sends this workflow to the AI application as part of its instructions when the connection is established.

Tools

All tools act on the SweepMe! instance that serves the port, and on the sequence that is currently loaded. Values are returned as text or JSON.

Status and info

Tool Arguments Description
get_status none Running and paused state, elapsed time, progress, branch index, version, and whether the data has been saved since the last run started.
get_sweepme_version none Version of the running SweepMe! instance, e.g. "1.6.1.7".
get_instance_info none Process id, executable, SweepMe! version, start time of the interface, URL, and the currently loaded sequence. Use it to check which instance you control if several SweepMe! instances are open.
get_measurement_progress none Progress of the current run: point, number of points and progress per branch, if available.
get_debug_log lines (integer, default 100), since_last_run (boolean) Last lines of the debug log. Useful to find the reason for an error during a run.

Measurement control

Tool Arguments Description
start_run none Starts the measurement of the loaded sequence and returns immediately.
stop_run none Stops the running measurement.
pause_run none Pauses the running measurement.
resume_run none Resumes a paused measurement.
skip_current_branch none Skips the current branch of the Sequencer and continues with the next one.
wait_for_completion timeout_s (number, default 600), poll_interval_s (number, default 2) Waits until the run has finished and returns completed, timed_out and the final status. If the timeout is reached, the tool returns with timed_out = true while the run continues, so the assistant can call it again.

Measurement values

Tool Arguments Description
list_measurement_parameters none All parameter keys that are currently registered, e.g. SMU1_Voltage_V. The keys depend on the modules of the loaded sequence, see Parameter system.
get_measurement_value key (string, required) Latest value of one parameter.
get_all_measurement_values none Latest values of all parameters as a dictionary.

Only the latest values are returned. The complete data of a run is in the data files, see Saving data.

Sequences and data files

Tool Arguments Description
load_sequence filepath (string, required) Loads a sequence (.seq) or a legacy setting (.set). Use the full file path. Only possible while no measurement is running.
get_current_setting none File path of the loaded sequence.
set_filename file_name (string, required) File name for the data of the next run, without folder.
set_folder folder (string, required) Name of the folder for the data, as in the field Folder of the Save Bar. It is created inside the measurement folder of the current profile, so pass a folder name, not a full path (the character ":" is not allowed).
save_data none Saves the data of the last run with the current folder and file name.

Driver and module versions

Tool Arguments Description
get_driver_version driver_name (string, required) Active version of a driver.
get_available_driver_versions driver_name (string, required) Installed versions of a driver.
set_driver_version driver_name, version_string (strings, required) Activates a version, e.g. a date like "2024-01-01" or "custom". Only possible while no measurement is running.
get_module_version module_name (string, required) Active version of a module.
get_available_module_versions module_name (string, required) Installed versions of a module.
set_module_version module_name, version_string (strings, required) Activates a version of a module, e.g. "1.6.1.1" or "custom".

See Version manager for the meaning of the versions.

Advanced

Tool Arguments Description
list_commands only_triggerable (boolean, default true) Lists the commands of SweepMe!, including the functions that modules and drivers of the loaded sequence register, e.g. actions of CustomFunction scripts. With true, only commands without arguments are listed.
call_command key (string, required), args (list), kwargs (dictionary) Calls a command from list_commands. The commands are the same as for the other interfaces.
close_sweepme none Closes SweepMe! without asking about unsaved changes. Only possible while no measurement is running. Assistants are told to use it only when asked to.

Technical details

  • Transport: streamable HTTP. Requests are sent with POST to /mcp. The server is stateless and does not offer a GET stream.
  • Supported MCP protocol versions: 2025-06-18, 2025-03-26 and 2024-11-05.
  • Server name: sweepme.
  • Requests from web pages of other websites are rejected (HTTP 403). Desktop applications and command line tools send no such header and are accepted.
  • The server has no authentication. See Authentication and security.

See also