get_trials
Retrieve all hyperparameter optimization trials in CSV format for analysis and visualization. Enhances workflow by enabling structured data extraction from Optuna MCP Server.
Instructions
Get all trials in a CSV format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- optuna_mcp/server.py:314-327 (handler)The core handler function for the 'get_trials' tool. It is a nested function inside register_tools, decorated with @mcp.tool(structured_output=False). It checks if a study exists, then retrieves all trials as a pandas DataFrame converted to CSV string and returns it prefixed with 'Trials: \n'.@mcp.tool(structured_output=False) def get_trials() -> str: """Get all trials in a CSV format""" if mcp.study is None: raise McpError( ErrorData( code=INTERNAL_ERROR, message="No study has been created. Please create a study first.", ) ) csv_string = mcp.study.trials_dataframe().to_csv() return f"Trials: \n{csv_string}"