Skip to main content
Glama

get_all_study_names

Retrieve all study names stored in the Optuna MCP Server to access and manage hyperparameter optimization datasets.

Instructions

Get all study names from the storage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_all_study_names' tool. It retrieves the Optuna storage from the MCP instance and uses optuna.get_all_study_names to fetch all study names, returning them as a list of StudyResponse objects.
    @mcp.tool(structured_output=True) def get_all_study_names() -> list[StudyResponse]: """Get all study names from the storage.""" storage: str | optuna.storages.BaseStorage | None = None if mcp.study is not None: storage = mcp.study._storage elif mcp.storage is not None: storage = mcp.storage else: raise McpError(ErrorData(code=INTERNAL_ERROR, message="No storage specified.")) study_names = optuna.get_all_study_names(storage) return [StudyResponse(study_name=name) for name in study_names]
  • Pydantic model defining the structured output schema for get_all_study_names, containing study_name and optional fields like sampler_name, directions, and metric_names.
    class StudyResponse(BaseModel): study_name: str sampler_name: SamplerName | None = Field( default=None, description="The name of the sampler used in the study." ) directions: list[DirectionName] | None = Field( default=None, description="The optimization directions for each objective." ) metric_names: list[str] | None = Field( default=None, description="The metric names for each objective." )
  • Call to register_tools(mcp) in the main function, which defines and registers the get_all_study_names tool (and others) using @mcp.tool decorators.
    mcp = register_tools(mcp)

Latest Blog Posts

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