Skip to main content
Glama

Optuna MCP Server

Official
by optuna

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
STORAGENoThe Optuna storage URL to persist results (e.g., 'sqlite:///optuna.db')

Schema

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription
create_study

Create a new Optuna study with the given study_name and directions.

If the study already exists, it will be simply loaded.
get_all_study_names

Get all study names from the storage.

ask

Suggest new parameters using Optuna

search_space must be a string that can be evaluated to a dictionary to specify Optuna's distributions. Example: {"x": {"name": "FloatDistribution", "attributes": {"step": null, "low": -10.0, "high": 10.0, "log": false}}}
tell

Report the result of a trial

set_sampler

Set the sampler for the study. The sampler must be one of the following: - TPESampler - NSGAIISampler - RandomSampler - GPSampler

The default sampler for single-objective optimization is TPESampler. The default sampler for multi-objective optimization is NSGAIISampler. GPSampler is a Gaussian process-based sampler suitable for low-dimensional numerical optimization problems.
set_trial_user_attr

Set user attributes for a trial

get_trial_user_attrs

Get user attributes in a trial

set_metric_names

Set metric_names. metric_names are labels used to distinguish what each objective value is.

Args: metric_names: The list of metric name for each objective value. The length of metric_names list must be the same with the number of objectives.
get_metric_names

Get metric_names

get_directions

Get the directions of the study.

get_trials

Get all trials in a CSV format

best_trial

Get the best trial

This feature can only be used for single-objective optimization. If your study is multi-objective, use best_trials instead.
best_trials

Return trials located at the Pareto front in the study.

add_trial

Add a trial to the study.

add_trials

Add multiple trials to the study.

plot_optimization_history

Return the optimization history plot as an image.

Args: target: An index to specify the value to display. To plot nth objective value, set this to n. Note that this is 0-indexed, i.e., to plot the first objective value, set this to 0. For single-objective optimization, None (auto) is recommended. For multi-objective optimization, this must be specified. target_name: Target's name to display on the axis label and the legend.
plot_hypervolume_history

Return the hypervolume history plot as an image.

Args: reference_point: A list of reference points to calculate the hypervolume.
plot_pareto_front

Return the Pareto front plot as an image for multi-objective optimization.

Args: target_names: Objective name list used as the axis titles. If :obj:`None` is specified, "Objective {objective_index}" is used instead. If ``targets`` is specified for a study that does not contain any completed trial, ``target_name`` must be specified. include_dominated_trials: A flag to include all dominated trial's objective values. targets: A list of indices to specify the objective values to display. Note that this is 0-indexed, i.e., to plot the first and second objective value, set this to [0, 1]. If the number of objectives is neither 2 nor 3, ``targets`` must be specified. By default, all objectives are displayed.
plot_contour

Return the contour plot as an image.

Args: params: Parameter list to visualize. The default is all parameters. target: An index to specify the value to display. To plot nth objective value, set this to n. Note that this is 0-indexed, i.e., to plot the first objective value, set this to 0. target_name: Target’s name to display on the color bar.
plot_parallel_coordinate

Return the parallel coordinate plot as an image.

Args: params: Parameter list to visualize. The default is all parameters. target: An index to specify the value to display. To plot nth objective value, set this to n. Note that this is 0-indexed, i.e., to plot the first objective value, set this to 0. target_name: Target’s name to display on the axis label and the legend.
plot_slice

Return the slice plot as an image.

Args: params: Parameter list to visualize. The default is all parameters. target: An index to specify the value to display. To plot nth objective value, set this to n. Note that this is 0-indexed, i.e., to plot the first objective value, set this to 0. target_name: Target’s name to display on the axis label.
plot_param_importances

Return the parameter importances plot as an image.

Args: params: Parameter list to visualize. The default is all parameters. target: An index to specify the value to display. To plot nth objective value, set this to n. Note that this is 0-indexed, i.e., to plot the first objective value, set this to 0. By default, all objective will be plotted by setting target to None. target_name: Target’s name to display on the legend.
plot_edf

Return the EDF plot as an image.

Args: target: An index to specify the value to display. To plot nth objective value, set this to n. Note that this is 0-indexed, i.e., to plot the first objective value, set this to 0. target_name: Target’s name to display on the axis label.
plot_timeline

Return the timeline plot as an image.

plot_rank

Return the rank plot as an image.

Args: params: Parameter list to visualize. The default is all parameters. target: An index to specify the value to display. To plot nth objective value, set this to n. Note that this is 0-indexed, i.e., to plot the first objective value, set this to 0. target_name: Target’s name to display on the color bar.
launch_optuna_dashboard

Launch the Optuna dashboard

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/optuna/optuna-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server