Skip to main content
Glama

read_compilation_result

Retrieve compilation results for QuantConnect trading algorithms, including state, logs, and error details to verify code compilation status.

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
project_idYes
compile_idYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the read_compilation_result tool. It fetches compilation results from the QuantConnect API, handles authentication, processes logs for warnings/errors, and returns structured 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, }

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