Skip to main content
Glama

read_live_chart

Retrieve real-time chart data from active trading algorithms to monitor performance and analyze strategy execution.

Instructions

Read chart data from a live algorithm.

Args: project_id: Project ID of the live algorithm name: Name of the chart to retrieve (e.g., "Strategy Equity") count: Number of data points to request (default: 100) start: Optional UTC start timestamp in seconds end: Optional UTC end timestamp in seconds

Returns: Dictionary containing live algorithm chart data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
nameYes
countNo
startNo
endNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'read_live_chart' tool. It authenticates with QuantConnect, prepares a request to the 'live/chart/read' endpoint with project_id, chart name, count, and optional timestamps, sends the POST request, and parses the response to return chart data, loading progress, or error details.
    @mcp.tool()
    async def read_live_chart(
        project_id: int,
        name: str,
        count: int = 100,
        start: Optional[int] = None,
        end: Optional[int] = None,
    ) -> Dict[str, Any]:
        """
        Read chart data from a live algorithm.
    
        Args:
            project_id: Project ID of the live algorithm
            name: Name of the chart to retrieve (e.g., "Strategy Equity")
            count: Number of data points to request (default: 100)
            start: Optional UTC start timestamp in seconds
            end: Optional UTC end timestamp in seconds
    
        Returns:
            Dictionary containing live algorithm chart data
        """
        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,
                "name": name,
                "count": count,
            }
    
            # Add optional timestamp parameters
            if start is not None:
                request_data["start"] = start
            if end is not None:
                request_data["end"] = end
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="live/chart/read", method="POST", json=request_data
            )
    
            # Parse response
            if response.status_code == 200:
                data = response.json()
    
                if data.get("success", False):
                    # Check if chart is still loading
                    if "progress" in data and "status" in data:
                        progress = data.get("progress", 0)
                        status = data.get("status", "loading")
                        return {
                            "status": "loading",
                            "project_id": project_id,
                            "chart_name": name,
                            "progress": progress,
                            "chart_status": status,
                            "message": f"Chart '{name}' is loading... ({progress * 100:.1f}% complete)",
                        }
    
                    # Chart is ready
                    elif "chart" in data:
                        chart = data.get("chart")
                        return {
                            "status": "success",
                            "project_id": project_id,
                            "chart_name": name,
                            "chart": chart,
                            "count": count,
                            "start": start,
                            "end": end,
                            "message": f"Successfully retrieved chart '{name}' from live algorithm {project_id}",
                        }
    
                    else:
                        return {
                            "status": "error",
                            "error": "Unexpected response format - no chart or progress data found",
                        }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "Failed to read live algorithm chart",
                        "details": errors,
                        "project_id": project_id,
                        "chart_name": name,
                    }
    
            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 read live algorithm chart: {str(e)}",
                "project_id": project_id,
                "chart_name": name,
            }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it 'retrieves' data without addressing behavioral aspects like authentication requirements, rate limits, error conditions, or data freshness. It mentions 'live algorithm' but doesn't clarify what 'live' entails operationally.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement followed by well-organized parameter documentation and return value indication. Every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/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, 5 parameters with 0% schema coverage, and no annotations, the description does well by documenting all parameters semantically. However, it lacks behavioral context about the 'live' aspect and doesn't mention the output schema's existence, though the Returns section provides basic guidance.

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?

The description provides clear semantic explanations for all 5 parameters beyond the schema's 0% coverage, including examples ('Strategy Equity'), defaults (count: 100), and format details (UTC timestamps in seconds). This compensates well for the schema's lack of descriptions.

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 verb 'Read' and resource 'chart data from a live algorithm', making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'read_backtest_chart' or 'read_live_algorithm', which would require a 5.

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 about when to use this tool versus alternatives like 'read_backtest_chart' for historical data or 'read_live_algorithm' for general algorithm info. The description lacks any context about prerequisites or appropriate use cases.

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