Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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}"

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