Skip to main content
Glama

create_live_algorithm

Deploy compiled trading algorithms to live brokerage connections for automated execution with real market data.

Instructions

Create a live algorithm deployment.

Args: project_id: ID of the project to deploy compile_id: Compile ID from successful project compilation node_id: ID of the node that will run the algorithm brokerage_id: Brokerage identifier (e.g., "QuantConnectBrokerage", "InteractiveBrokersBrokerage") brokerage_config: Brokerage configuration dictionary with credentials and settings data_providers: Optional data provider configurations (defaults to same as brokerage) version_id: Version of Lean to use (default: "-1" for master) parameters: Optional algorithm parameters notifications: Optional notification settings

Returns: Dictionary containing live algorithm deployment result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
compile_idYes
node_idYes
brokerage_idYes
brokerage_configYes
data_providersNo
version_idNo-1
parametersNo
notificationsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'create_live_algorithm' tool. It validates inputs, prepares a request payload, authenticates using get_auth_instance(), and makes a POST request to QuantConnect's 'live/create' endpoint to deploy a live algorithm. Handles success/error responses and returns structured results.
    @mcp.tool()
    async def create_live_algorithm(
        project_id: int,
        compile_id: str,
        node_id: str,
        brokerage_id: str,
        brokerage_config: Dict[str, Any],
        data_providers: Optional[Dict[str, Any]] = None,
        version_id: str = "-1",
        parameters: Optional[Dict[str, Any]] = None,
        notifications: Optional[Dict[str, Any]] = None,
    ) -> Dict[str, Any]:
        """
        Create a live algorithm deployment.
    
        Args:
            project_id: ID of the project to deploy
            compile_id: Compile ID from successful project compilation
            node_id: ID of the node that will run the algorithm
            brokerage_id: Brokerage identifier (e.g., "QuantConnectBrokerage", "InteractiveBrokersBrokerage")
            brokerage_config: Brokerage configuration dictionary with credentials and settings
            data_providers: Optional data provider configurations (defaults to same as brokerage)
            version_id: Version of Lean to use (default: "-1" for master)
            parameters: Optional algorithm parameters
            notifications: Optional notification settings
    
        Returns:
            Dictionary containing live algorithm deployment result
        """
        auth = get_auth_instance()
        if auth is None:
            return {
                "status": "error",
                "error": "QuantConnect authentication not configured. Use configure_auth() first.",
            }
    
        # Validate required brokerage config
        if not isinstance(brokerage_config, dict) or "id" not in brokerage_config:
            return {
                "status": "error",
                "error": "brokerage_config must be a dictionary with 'id' field",
            }
    
        try:
            # Prepare request data
            request_data = {
                "versionId": version_id,
                "projectId": project_id,
                "compileId": compile_id,
                "nodeId": node_id,
                "brokerage": brokerage_config,
            }
    
            # Set up data providers (default to same as brokerage if not specified)
            if data_providers is None:
                request_data["dataProviders"] = {
                    brokerage_id: {"id": brokerage_id}
                }
            else:
                request_data["dataProviders"] = data_providers
    
            # Add optional parameters
            if parameters:
                request_data["parameters"] = parameters
            else:
                request_data["parameters"] = {}
    
            if notifications:
                request_data["notification"] = notifications
            else:
                request_data["notification"] = {}
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="live/create", method="POST", json=request_data
            )
    
            # Parse response
            if response.status_code == 200:
                data = response.json()
    
                if data.get("success", False):
                    live_algorithm = data.get("live", {})
                    deploy_id = live_algorithm.get("deployId")
                    status = live_algorithm.get("status")
    
                    return {
                        "status": "success",
                        "project_id": project_id,
                        "compile_id": compile_id,
                        "deploy_id": deploy_id,
                        "live_status": status,
                        "brokerage": live_algorithm.get("brokerage"),
                        "launched": live_algorithm.get("launched"),
                        "live_algorithm": live_algorithm,
                        "message": f"Successfully created live algorithm {deploy_id} with status: {status}",
                    }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "Live algorithm creation 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 create live algorithm: {str(e)}",
                "project_id": project_id,
                "compile_id": compile_id,
            }
  • Calls register_live_tools(mcp) to register the create_live_algorithm tool (and other live tools) with the MCP server during initialization.
    register_live_tools(mcp)
  • Alternative entry point that calls register_live_tools(mcp) to register the live tools including create_live_algorithm.
    register_live_tools(mcp)
  • The registration function that defines and registers the create_live_algorithm tool via @mcp.tool() decorator.
    def register_live_tools(mcp: FastMCP):
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions this creates a deployment (implying a write/mutation operation), it doesn't disclose critical behavioral traits like required permissions, whether this is a long-running operation, potential costs, rate limits, or what happens if deployment fails. The return format is mentioned but without details.

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 with clear sections for Args and Returns. Each sentence earns its place by providing essential information. While slightly longer than minimal, the structure makes it scannable and the content is all relevant to tool understanding.

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 complexity (9 parameters, 5 required, nested objects) and no annotations, the description does a decent job but has gaps. It covers parameters well and mentions the return type, but lacks behavioral context about permissions, costs, or operational characteristics. The existence of an output schema helps, but for a deployment tool with significant implications, more context would be beneficial.

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

Parameters4/5

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

With 0% schema description coverage, the description provides excellent parameter semantics that compensate well. It explains what each parameter represents (e.g., 'ID of the project to deploy', 'Compile ID from successful project compilation', 'Brokerage configuration dictionary with credentials and settings'), adds context about defaults, and clarifies optional parameters. Only minor details like format expectations for IDs are missing.

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

Purpose5/5

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

The description clearly states the specific action ('Create a live algorithm deployment') with the exact resource involved. It distinguishes itself from siblings like 'create_backtest' or 'create_optimization' by specifying it's for live deployment, not backtesting or optimization.

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 like 'create_backtest' or 'create_optimization'. It mentions prerequisites like 'successful project compilation' but doesn't explicitly state when this tool is appropriate or what alternatives exist for different scenarios.

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