Skip to main content
Glama

read_compilation_result

Retrieve compilation job results, including state, logs, and errors, by specifying project ID and compile ID. Essential for verifying successful code compilation in QuantConnect MCP Server.

Instructions

Read the result of a compilation job in QuantConnect.

Args: project_id: The ID of the project that was compiled. compile_id: The compile ID returned from compile_project.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compile_idYes
project_idYes

Implementation Reference

  • Implementation of the read_compilation_result tool handler. This async function handles the tool execution, makes API calls to QuantConnect's compile/read endpoint, processes the response including warnings and errors, and returns formatted results.
    @mcp.tool() async def read_compilation_result(project_id: int, compile_id: str) -> Dict[str, Any]: """ Read the result of a compilation job in QuantConnect. Args: project_id: The ID of the project that was compiled. compile_id: The compile ID returned from compile_project. Returns: A dictionary containing the compilation result with state, logs, and errors. """ 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 and compile ID in JSON payload request_data = {"projectId": project_id, "compileId": compile_id} response = await auth.make_authenticated_request( endpoint="compile/read", method="POST", json=request_data ) if response.status_code == 200: data = response.json() if data.get("success"): logs = data.get("logs", []) errors = data.get("errors", []) state = data.get("state") # Check for compilation warnings in logs that indicate issues warnings = [] for log in logs: if "Warning" in log: warnings.append(log) # If there are warnings or explicit errors, treat as compilation failure if warnings or errors: return { "status": "error", "compile_id": data.get("compileId"), "state": state, "project_id": data.get("projectId"), "signature": data.get("signature"), "signature_order": data.get("signatureOrder", []), "logs": logs, "errors": errors, "warnings": warnings, "message": f"Compilation completed with {len(warnings)} warnings and {len(errors)} errors. Code issues must be fixed before proceeding.", "error": f"Compilation failed: {len(warnings)} warnings, {len(errors)} errors found", } return { "status": "success", "compile_id": data.get("compileId"), "state": state, "project_id": data.get("projectId"), "signature": data.get("signature"), "signature_order": data.get("signatureOrder", []), "logs": logs, "errors": errors, "message": f"Compilation result retrieved successfully. State: {state}", } else: return { "status": "error", "error": "Failed to read compilation result.", "details": data.get("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"An unexpected error occurred: {e}", "project_id": project_id, "compile_id": compile_id, }
  • Call to register_project_tools(mcp) which registers the read_compilation_result tool (among others) with the MCP server.
    register_project_tools(mcp) register_file_tools(mcp) register_backtest_tools(mcp) register_live_tools(mcp) register_optimization_tools(mcp)

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