Qiskit Gym MCP Server
v0.4.2MCP server for qiskit-gym reinforcement learning quantum circuit synthesis
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
create_permutation_env_tool
Create a PermutationGym environment for learning qubit routing with SWAP gates. Use this to create an RL environment that learns to implement arbitrary qubit permutations using minimal SWAP gates on constrained coupling maps.
| Parameter | Type | Description |
|---|---|---|
coupling_map | Custom coupling map as list of [qubit1, qubit2] edges. Example: [[0,1], [1,2], [2,3]] for a linear chain. | |
preset | Hardware preset name (use instead of coupling_map). Options: "ibm_heron_r1", "ibm_heron_r2", "ibm_nighthawk", "grid_3x3", "grid_5x5", "linear_5", "linear_10" |
create_linear_function_env_tool
Create a LinearFunctionGym environment for learning CNOT synthesis. The environment learns to decompose linear Boolean functions into efficient quantum circuits using CNOT gates.
| Parameter | Type | Description |
|---|---|---|
basis_gates | Optional list of basis gates (default: ["cx"]) | |
coupling_map | Custom coupling map as list of [qubit1, qubit2] edges. | |
preset | Hardware preset name (e.g., "ibm_nighthawk", "grid_3x3") |
create_clifford_env_tool
Create a CliffordGym environment for learning Clifford circuit synthesis. The environment learns to synthesize optimal implementations of Clifford group elements using a customizable gate set.
| Parameter | Type | Description |
|---|---|---|
num_qubits * | integer | Number of qubits for the environment |
coupling_map | Custom coupling map (optional) | |
gateset | Custom gate set. Can be: - List of gate names: ["H", "S", "CX"] (applied to all qubits/edges) - List of dicts: [{"gate": "H", "qubits": [0]}, {"gate": "CX", "qubits": [0, 1]}] | |
preset | Hardware preset name (optional) |
list_environments_tool
List all active RL environments. Returns: Dict with list of environments and their info.
get_environment_info_tool
Get detailed information about a specific environment.
| Parameter | Type | Description |
|---|---|---|
env_id * | string | Environment ID |
delete_environment_tool
Delete an environment.
| Parameter | Type | Description |
|---|---|---|
env_id * | string | Environment ID to delete |
start_training_tool
Start training an RL agent on a created environment. This initiates training that learns to synthesize optimal circuits.
| Parameter | Type | Description |
|---|---|---|
env_id * | string | Environment ID from create_*_env_tool |
algorithm | string | RL algorithm to use: - "ppo": Proximal Policy Optimization (recommended, faster) - "alphazero": AlphaZero-style MCTS (better for complex problems) |
background | boolean | If True, run training in background and return immediately. Use get_training_status_tool to poll progress, or wait_for_training_tool to block until done. Default: False (synchronous). |
num_iterations | integer | Number of training iterations. Default: 100 |
policy | string | Neural network policy architecture: - "basic": Simple feedforward network (faster, good for small problems) - "conv1d": 1D convolutional network (better for larger problems) |
tensorboard_experiment | Name for TensorBoard logging (optional) |
batch_train_environments_tool
Train multiple environments in sequence. Useful for training models across multiple topologies or subtopologies extracted from hardware.
| Parameter | Type | Description |
|---|---|---|
env_ids * | array | List of environment IDs to train |
algorithm | string | RL algorithm to use |
background | boolean | If True, start all training in background and return immediately. Use get_training_status_tool or wait_for_training_tool to monitor. |
num_iterations | integer | Number of iterations per environment |
policy | string | Neural network policy architecture |
tensorboard_prefix | Prefix for TensorBoard experiment names |
get_training_status_tool
Get the status and metrics of a training session.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Training session ID |
get_training_metrics_tool
Get detailed training metrics from TensorBoard logs. Returns the progression of difficulty, success rate, and reward throughout training. Use this after training completes to understand how well the model trained and what difficulty level it reached.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Training session ID |
wait_for_training_tool
Wait for a background training session to complete. Blocks until training completes, fails, or times out. Use this after starting training with background=True.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Training session ID to wait for |
timeout | integer | Maximum time to wait in seconds (default: 600 = 10 minutes) |
stop_training_tool
Stop a training session.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Training session ID to stop |
list_training_sessions_tool
List all training sessions. Returns: Dict with list of training sessions.
list_tensorboard_experiments_tool
List available TensorBoard experiments from past training runs. Returns a list of experiment names that can be used with get_tensorboard_metrics_tool to view historical training metrics. Returns: Dict with list of experiment names (newest first).
get_tensorboard_metrics_tool
Get training metrics from TensorBoard logs for historical runs. Use this to read metrics from past training runs that are no longer in the active session list. Use list_tensorboard_experiments_tool to see available experiments.
| Parameter | Type | Description |
|---|---|---|
experiment_name | Name of the TensorBoard experiment (e.g., "linear_function_train_0001_abc123"). | |
tensorboard_path | Direct path to TensorBoard logs (alternative to name). |
start_tensorboard_tool
Start TensorBoard to visualize training metrics. Launches TensorBoard as a background process using the configured QISKIT_GYM_TENSORBOARD_DIR as the log directory.
| Parameter | Type | Description |
|---|---|---|
port | integer | The port to run TensorBoard on (default: 6006) |
stop_tensorboard_tool
Stop the running TensorBoard process. Terminates the TensorBoard process that was started with start_tensorboard_tool. Returns: Dict with status message indicating whether TensorBoard was stopped.
get_tensorboard_status_tool
Check the status of the TensorBoard process. Returns whether TensorBoard is running and on which port. Returns: Dict with running status, port, and URL if running.
synthesize_permutation_tool
Synthesize an optimal quantum circuit for a qubit permutation. Uses a trained PermutationGym model to find an optimal SWAP gate sequence that implements the desired qubit permutation on the coupling map.
| Parameter | Type | Description |
|---|---|---|
model_id * | string | ID of a loaded PermutationGym model |
permutation * | array | Target permutation as list of qubit indices. Example: [2, 0, 1] means qubit 0 -> position 2, qubit 1 -> position 0 |
deterministic | boolean | If True, use deterministic action selection |
num_searches | integer | Number of search attempts. Higher = better results. Max: 10000 |
synthesize_linear_function_tool
Synthesize an optimal quantum circuit for a linear Boolean function. Uses a trained LinearFunctionGym model to find an optimal CNOT circuit.
| Parameter | Type | Description |
|---|---|---|
linear_function * | array | NxN binary matrix representing the linear function. Entry [i][j]=1 means output i depends on input j (XOR). |
model_id * | string | ID of a loaded LinearFunctionGym model |
deterministic | boolean | If True, use deterministic action selection |
num_searches | integer | Number of search attempts. Max: 10000 |
synthesize_clifford_tool
Synthesize an optimal quantum circuit for a Clifford operation. Uses a trained CliffordGym model to find an optimal Clifford implementation.
| Parameter | Type | Description |
|---|---|---|
clifford_tableau * | Clifford tableau in standard (2N+1 x 2N) format, or dict with "destab" and "stab" matrices. | |
model_id * | string | ID of a loaded CliffordGym model |
deterministic | boolean | If True, use deterministic action selection |
num_searches | integer | Number of search attempts. Max: 10000 |
save_model_tool
Save a trained model to disk. Save by session_id (from just-completed training) or model_id (loaded model).
| Parameter | Type | Description |
|---|---|---|
model_id | Model ID (alternative to session_id) | |
model_name | Name to save as (defaults to auto-generated) | |
session_id | Training session ID (from start_training result) |
load_model_tool
Load a saved model from disk.
| Parameter | Type | Description |
|---|---|---|
model_name * | string | Name of the model to load |
list_saved_models_tool
List all models saved to disk. Returns: Dict with list of saved models.
list_loaded_models_tool
List all models currently loaded in memory.
| Parameter | Type | Description |
|---|---|---|
filter_type | Optional filter by env_type or model name prefix |
delete_model_tool
Delete a model.
| Parameter | Type | Description |
|---|---|---|
model_name * | string | Name of the model to delete |
delete_files | boolean | If True, also delete saved files from disk |
get_model_info_tool
Get detailed information about a model.
| Parameter | Type | Description |
|---|---|---|
model_id | Model ID (for loaded models) | |
model_name | Model name (can also check saved models on disk) |
create_coupling_map_tool
Create a custom coupling map.
| Parameter | Type | Description |
|---|---|---|
bidirectional | boolean | Whether edges are bidirectional (default: True) |
cols | Number of columns (for grid topology) | |
edges | Custom edges as [[q1, q2], ...] (mutually exclusive with topology) | |
num_qubits | Number of qubits (for line topology) | |
rows | Number of rows (for grid topology) | |
topology | Topology type ("grid", "line") (mutually exclusive with edges) |
extract_subtopologies_tool
Extract connected subtopologies of N qubits from a hardware preset. Use this to find all unique connected subgraphs of a specified size from a larger coupling map. Essential for training RL models on subtopologies of real quantum hardware like IBM Nighthawk.
| Parameter | Type | Description |
|---|---|---|
edges | Custom coupling map edges (alternative to preset) | |
max_subtopologies | integer | Maximum number of subtopologies to return (default: 50) |
num_qubits | integer | Number of qubits for subtopologies (default: 4) |
preset | Hardware preset name (e.g., "ibm_nighthawk", "ibm_heron_r1") |
list_subtopology_shapes_tool
List available subtopology shapes for a given hardware and qubit count. Summarizes the types of subtopologies available (line, grid, star, etc.) without returning all edges.
| Parameter | Type | Description |
|---|---|---|
num_qubits * | integer | Number of qubits for subtopologies |
preset * | string | Hardware preset name |
get_fake_backend_coupling_map_tool
Get the exact coupling map from a fake IBM backend (no credentials needed). Use this to get exact IBM Quantum hardware topologies without needing IBM Quantum credentials. This is the recommended way to get accurate topologies for offline development.
| Parameter | Type | Description |
|---|---|---|
backend_name * | string | Backend name (e.g., "ibm_fez", "ibm_brisbane", "ibm_boston", "ibm_sherbrooke"). Use list_available_fake_backends to see all options. |
list_available_fake_backends_tool
List all available fake backends for offline topology access. Returns a list of IBM Quantum backends that have fake versions available in qiskit-ibm-runtime. These provide exact coupling maps without needing IBM Quantum credentials. Returns: Dict with list of backends, their qubit counts, and usage instructions.
generate_random_permutation_tool
Generate a random permutation for testing synthesis.
| Parameter | Type | Description |
|---|---|---|
num_qubits * | integer | Number of qubits |
generate_random_linear_function_tool
Generate a random invertible linear function for testing.
| Parameter | Type | Description |
|---|---|---|
num_qubits * | integer | Number of qubits |
generate_random_clifford_tool
Generate a random Clifford element for testing.
| Parameter | Type | Description |
|---|---|---|
num_qubits * | integer | Number of qubits |
convert_qpy_to_qasm3_tool
Convert a QPY circuit to human-readable QASM3 format. Use this tool to view the contents of a QPY circuit output from synthesis tools (like synthesize_permutation, synthesize_linear_function, synthesize_clifford) in a human-readable OpenQASM 3.0 format.
| Parameter | Type | Description |
|---|---|---|
circuit_qpy * | string | Base64-encoded QPY circuit string (from synthesis output) |
convert_qasm3_to_qpy_tool
Convert a QASM3 (or QASM2) circuit to base64-encoded QPY format. Use this tool to convert human-readable QASM circuits to QPY format, which preserves full circuit fidelity. The QPY output can be used with synthesis tools that may require circuit input.
| Parameter | Type | Description |
|---|---|---|
circuit_qasm * | string | OpenQASM 3.0 or 2.0 circuit string |