Skip to main content
Glama

list_backtests

Retrieve all backtests for a specific project to analyze historical strategy performance and review testing results.

Instructions

List all backtests for a project.

Args: project_id: ID of the project to list backtests from

Returns: Dictionary containing list of backtests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'list_backtests' tool. It authenticates with QuantConnect, makes a POST request to the 'backtests/list' endpoint, parses the response, and returns a structured dictionary with the list of backtests or error information.
    @mcp.tool()
    async def list_backtests(project_id: int) -> Dict[str, Any]:
        """
        List all backtests for a project.
    
        Args:
            project_id: ID of the project to list backtests from
    
        Returns:
            Dictionary containing list of backtests
        """
        auth = get_auth_instance()
        if auth is None:
            return {
                "status": "error",
                "error": "QuantConnect authentication not configured. Use configure_auth() first.",
            }
    
        try:
            # Prepare request data
            request_data = {"projectId": project_id}
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="backtests/list", method="POST", json=request_data
            )
    
            # Parse response
            if response.status_code == 200:
                data = response.json()
    
                if data.get("success", False):
                    backtests = data.get("backtests", [])
                    
                    return {
                        "status": "success",
                        "project_id": project_id,
                        "backtests": backtests,
                        "total_backtests": len(backtests),
                        "message": f"Successfully retrieved {len(backtests)} backtests from project {project_id}",
                    }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "Failed to list backtests",
                        "details": errors,
                        "project_id": project_id,
                    }
    
            elif response.status_code == 401:
                return {
                    "status": "error",
                    "error": "Authentication failed. Check your credentials and ensure they haven't expired.",
                }
    
            else:
                return {
                    "status": "error",
                    "error": f"API request failed with status {response.status_code}",
                    "response_text": (
                        response.text[:500]
                        if hasattr(response, "text")
                        else "No response text"
                    ),
                }
    
        except Exception as e:
            return {
                "status": "error",
                "error": f"Failed to list backtests: {str(e)}",
                "project_id": project_id,
            }
  • Registers the backtest tools module, including 'list_backtests', by calling the register_backtest_tools function with the MCP instance.
    register_backtest_tools(mcp)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool lists backtests but doesn't describe key behaviors: whether it's paginated, sorted, or filtered; what permissions are required; if it's read-only (implied but not stated); or error conditions. For a list operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence states the core purpose, followed by structured 'Args' and 'Returns' sections. There's no wasted text, though the structure is basic. Every sentence earns its place, but it could be more polished (e.g., integrating the return info into the main description).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, list operation) and the presence of an output schema (which handles return values), the description is minimally complete. However, with no annotations and 0% schema description coverage, it lacks behavioral context (e.g., pagination, errors) and usage guidelines. It meets the bare minimum but leaves the agent to guess about important operational aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal semantics beyond the input schema. It explains 'project_id' as 'ID of the project to list backtests from', which clarifies the parameter's role but doesn't provide format details (e.g., integer type, where to find it) or constraints. With 0% schema description coverage and only 1 parameter, this is adequate but not comprehensive—baseline 3 is appropriate as the description compensates slightly for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('backtests for a project'), making the purpose specific and understandable. It distinguishes from siblings like 'read_backtest' (which gets details of a single backtest) by focusing on listing multiple backtests. However, it doesn't explicitly differentiate from 'list_optimizations' or 'list_live_algorithms' which are similar list operations for different resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing project), exclusions, or comparisons to siblings like 'read_backtest' (for single backtest details) or 'list_optimizations' (for listing optimizations instead). The agent must infer usage from the name and context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/taylorwilsdon/quantconnect-mcp'

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