Skip to main content
Glama

update_optimization

Modify the name of an existing optimization in QuantConnect's trading platform to reflect changes or improvements in strategy analysis.

Instructions

Update the name of an optimization.

Args: optimization_id: ID of the optimization to update name: New name for the optimization

Returns: Dictionary containing update result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
optimization_idYes
nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler function for 'update_optimization'. Decorated with @mcp.tool(), it handles updating the name of an optimization job by making an authenticated POST request to the QuantConnect API endpoint 'optimizations/update'.
    @mcp.tool()
    async def update_optimization(
        optimization_id: str,
        name: str
    ) -> Dict[str, Any]:
        """
        Update the name of an optimization.
    
        Args:
            optimization_id: ID of the optimization to update
            name: New name for the optimization
    
        Returns:
            Dictionary containing update result
        """
        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 = {
                "optimizationId": optimization_id,
                "name": name
            }
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="optimizations/update", method="POST", json=request_data
            )
    
            # Parse response
            if response.status_code == 200:
                data = response.json()
    
                if data.get("success", False):
                    return {
                        "status": "success",
                        "optimization_id": optimization_id,
                        "new_name": name,
                        "message": f"Successfully updated optimization {optimization_id} name to '{name}'",
                    }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "Optimization update failed",
                        "details": errors,
                        "optimization_id": optimization_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 update optimization: {str(e)}",
                "optimization_id": optimization_id,
            }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is an update operation, implying mutation, but doesn't disclose behavioral traits like required permissions, whether changes are reversible, rate limits, or what 'update result' entails. The description adds minimal context beyond the basic action.

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: the first sentence states the purpose clearly. The 'Args' and 'Returns' sections are structured but slightly redundant with the schema. Every sentence adds value, though the 'Returns' line could be more specific given the output schema exists.

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 2 parameters with 0% schema coverage and no annotations, the description provides basic parameter semantics and mentions a return value. However, as a mutation tool, it lacks behavioral context (e.g., permissions, side effects). The output schema exists, so describing return values isn't needed, but overall completeness is minimal for safe use.

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 compensates by documenting both parameters ('optimization_id' and 'name') with brief semantics ('ID of the optimization to update' and 'New name for the optimization'). However, it doesn't add format details (e.g., ID structure, name constraints) or examples, leaving gaps.

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 tool's purpose: 'Update the name of an optimization.' This specifies the verb ('update'), resource ('optimization'), and what is being updated ('name'). It distinguishes from siblings like 'update_backtest' or 'update_file_name' by focusing on optimizations specifically. However, it doesn't explicitly differentiate from 'update_project' or 'update_project_nodes' in terms of resource hierarchy.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing optimization), exclusions, or comparisons with sibling tools like 'create_optimization' or 'delete_optimization'. The agent must infer usage from the name and context 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