Skip to main content
Glama

list_optimizations

Retrieve all optimization runs for a specific project to analyze performance improvements and parameter tuning results.

Instructions

List all optimizations for a project.

Args: project_id: ID of the project to list optimizations for

Returns: Dictionary containing list of optimizations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function decorated with @mcp.tool() that implements the list_optimizations tool. It lists optimizations for a given project_id by calling the QuantConnect API endpoint 'optimizations/list'.
    @mcp.tool()
    async def list_optimizations(
        project_id: int
    ) -> Dict[str, Any]:
        """
        List all optimizations for a project.
    
        Args:
            project_id: ID of the project to list optimizations for
    
        Returns:
            Dictionary containing list of optimizations
        """
        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}
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="optimizations/list", method="POST", json=request_data
            )
    
            # Parse response
            if response.status_code == 200:
                data = response.json()
    
                if data.get("success", False):
                    optimizations = data.get("optimizations", [])
                    
                    return {
                        "status": "success",
                        "project_id": project_id,
                        "optimizations": optimizations,
                        "total_optimizations": len(optimizations),
                        "message": f"Successfully retrieved {len(optimizations)} optimizations for project {project_id}",
                    }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "Failed to list optimizations",
                        "details": 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"Failed to list optimizations: {str(e)}",
                "project_id": project_id,
            }
  • The call to register_optimization_tools(mcp) in the main entry point, which registers the list_optimizations tool by defining it with @mcp.tool().
    register_optimization_tools(mcp)
  • The call to register_optimization_tools(mcp) in the server module, which registers the list_optimizations tool.
    register_optimization_tools(mcp)
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool lists optimizations but doesn't disclose behavioral traits such as whether it's read-only (implied by 'list'), pagination, rate limits, authentication needs, error conditions, or what happens if the project_id is invalid. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 appropriately sized and front-loaded with the main purpose in the first sentence. The Args and Returns sections are structured but could be more concise (e.g., integrating into a single paragraph). No wasted sentences, though it's slightly verbose for such a simple tool.

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 low complexity (one parameter) and the presence of an output schema (which handles return values), the description is mostly complete for basic use. However, with no annotations and 0% schema coverage, it lacks behavioral context (e.g., safety, errors) and deeper parameter guidance, making it adequate but with clear gaps.

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

Parameters3/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds basic semantics by explaining 'project_id' as 'ID of the project to list optimizations for', which clarifies the parameter's purpose. However, it doesn't provide details like format constraints, valid ranges, or examples, leaving some ambiguity. With one parameter, this is minimally adequate.

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 'list' and resource 'optimizations for a project', making the purpose specific and understandable. It distinguishes from siblings like 'read_optimization' (singular) and 'create_optimization', but doesn't explicitly differentiate from other list tools like 'list_backtests' or 'list_live_algorithms' beyond the resource name.

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 on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., if the project must exist), exclusions, or comparisons to siblings like 'read_optimization' for single optimizations or other list tools. Usage is implied by the name and description alone.

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