Skip to main content
Glama

compile_project

Compile a project in QuantConnect to generate a compilation result, including ID, state, and logs, by specifying the project ID for processing.

Instructions

Compile a project in QuantConnect.

Args: project_id: The ID of the project to compile.

Returns: A dictionary containing the compilation result with compile ID, state, and logs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Implementation Reference

  • The core handler for the 'compile_project' tool. Decorated with @mcp.tool() and implements the logic to initiate project compilation via QuantConnect API, returning compile ID and initial status.
    @mcp.tool() async def compile_project(project_id: int) -> Dict[str, Any]: """ Compile a project in QuantConnect. Args: project_id: The ID of the project to compile. Returns: A dictionary containing the compilation result with compile ID, state, and logs. """ auth = get_auth_instance() if auth is None: return { "status": "error", "error": "QuantConnect authentication not configured. Use configure_auth() first.", } try: # Prepare request data with project ID in JSON payload request_data = {"projectId": project_id} response = await auth.make_authenticated_request( endpoint="compile/create", method="POST", json=request_data ) if response.status_code == 200: data = response.json() if data.get("success"): return { "status": "success", "compile_id": data.get("compileId"), "state": data.get("state"), "project_id": data.get("projectId"), "signature": data.get("signature"), "signature_order": data.get("signatureOrder", []), "logs": data.get("logs", []), "message": "Project compilation started successfully.", } else: return { "status": "error", "error": "Project compilation failed.", "details": data.get("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"An unexpected error occurred: {e}", "project_id": project_id, }
  • Registers the project_tools module (containing compile_project) by calling register_project_tools(mcp) during server initialization.
    safe_print("🔧 Registering QuantConnect tools...") register_auth_tools(mcp) register_project_tools(mcp) register_file_tools(mcp) register_backtest_tools(mcp) register_live_tools(mcp) register_optimization_tools(mcp)
  • Registers the project_tools module (containing compile_project) by calling register_project_tools(mcp) in the main entry point.
    safe_print("🔧 Registering QuantConnect tools...") register_auth_tools(mcp) register_project_tools(mcp) register_file_tools(mcp) register_backtest_tools(mcp) register_live_tools(mcp) register_optimization_tools(mcp)
  • Type signature and docstring defining the tool's input parameter (project_id: int) and output format (Dict with status, compile_id, state, logs, etc.).
    async def compile_project(project_id: int) -> Dict[str, Any]: """ Compile a project in QuantConnect. Args: project_id: The ID of the project to compile. Returns: A dictionary containing the compilation result with compile ID, state, and logs. """
  • Error message in create_backtest tool referencing the compile_project tool as prerequisite.
    "status": "error", "error": "Compile ID not found. Please compile the project first using the 'compile_project' tool.", "details": errors, "project_id": project_id, "compile_id": compile_id, }

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