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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- optuna_mcp/server.py:122-135 (handler)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]
- optuna_mcp/server.py:71-82 (schema)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." )
- optuna_mcp/server.py:686-686 (registration)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)