Skip to main content
Glama

estimate_optimization_time

Estimate execution time for algorithmic trading strategy optimization using specified parameters and node configuration.

Instructions

Estimate the execution time of an optimization with the specified parameters.

Args: project_id: ID of the project to optimize compile_id: Compile ID from successful project compilation node_type: Type of node to use for optimization parameters: Dictionary of optimization parameters

Returns: Dictionary containing estimated optimization time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
compile_idYes
node_typeYes
parametersYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'estimate_optimization_time' tool. It makes an authenticated API request to QuantConnect's optimizations/estimate endpoint to estimate the execution time based on project details and parameters.
    @mcp.tool()
    async def estimate_optimization_time(
        project_id: int,
        compile_id: str,
        node_type: str,
        parameters: Dict[str, Any],
    ) -> Dict[str, Any]:
        """
        Estimate the execution time of an optimization with the specified parameters.
    
        Args:
            project_id: ID of the project to optimize
            compile_id: Compile ID from successful project compilation
            node_type: Type of node to use for optimization
            parameters: Dictionary of optimization parameters
    
        Returns:
            Dictionary containing estimated optimization time
        """
        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,
                "compileId": compile_id,
                "nodeType": node_type,
                "parameters": parameters,
            }
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="optimizations/estimate", method="POST", json=request_data
            )
    
            # Parse response
            if response.status_code == 200:
                data = response.json()
    
                if data.get("success", False):
                    return {
                        "status": "success",
                        "project_id": project_id,
                        "compile_id": compile_id,
                        "node_type": node_type,
                        "estimated_time": data.get("estimatedTime"),
                        "message": f"Successfully estimated optimization time for project {project_id}",
                    }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "Optimization time estimation failed",
                        "details": errors,
                        "project_id": project_id,
                        "compile_id": compile_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 estimate optimization time: {str(e)}",
                "project_id": project_id,
                "compile_id": compile_id,
            }
  • Registration of optimization tools (including estimate_optimization_time) by calling register_optimization_tools(mcp) in the main server setup.
    register_optimization_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. It states this is an estimation tool (implying it's likely read-only and non-destructive), but doesn't disclose any behavioral traits like whether it requires authentication, has rate limits, what happens with invalid inputs, or if it performs any side effects. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 well-structured and appropriately sized. It starts with a clear purpose statement, then lists parameters and return value in separate sections. Every sentence serves a purpose, though the parameter descriptions could be more informative. It's front-loaded with the main functionality.

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 moderate complexity (4 parameters including a nested object), no annotations, and an output schema (which handles return values), the description is partially complete. It covers the basic purpose and parameters at a high level, but lacks crucial context like usage prerequisites, parameter details, and behavioral constraints that would be needed for reliable tool invocation.

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?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description lists the four parameters in the 'Args' section with brief labels (e.g., 'ID of the project to optimize'), which adds some meaning beyond the bare schema. However, it doesn't explain parameter formats, constraints, or provide examples (e.g., what 'node_type' values are valid, what 'parameters' dictionary should contain), leaving key details unclear.

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 tool's purpose: 'Estimate the execution time of an optimization with the specified parameters.' It specifies the verb ('estimate') and resource ('execution time of an optimization'), but doesn't explicitly differentiate it from sibling tools like 'create_optimization' or 'read_optimization' beyond the estimation focus.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a successful compilation first), nor does it contrast with sibling tools like 'create_optimization' (which might actually run the optimization) or 'read_optimization' (which might retrieve results). The description only states what it does, not when it's appropriate.

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