Skip to main content
Glama

delete_optimization

Remove an optimization from the QuantConnect trading platform by specifying its ID to manage strategy testing resources.

Instructions

Delete an optimization.

Args: optimization_id: ID of the optimization to delete

Returns: Dictionary containing deletion result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
optimization_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function decorated with @mcp.tool() that implements the delete_optimization tool. It performs an authenticated POST request to the QuantConnect API endpoint 'optimizations/delete' to delete the specified optimization and handles various response cases.
    @mcp.tool()
    async def delete_optimization(
        optimization_id: str
    ) -> Dict[str, Any]:
        """
        Delete an optimization.
    
        Args:
            optimization_id: ID of the optimization to delete
    
        Returns:
            Dictionary containing deletion 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}
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="optimizations/delete", 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,
                        "message": f"Successfully deleted optimization {optimization_id}",
                    }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "Optimization deletion 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 delete optimization: {str(e)}",
                "optimization_id": optimization_id,
            }
  • Invocation of register_optimization_tools(mcp) in the main entry point, which defines and registers the optimization tools including delete_optimization via their decorators.
    register_optimization_tools(mcp)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'Delete[s] an optimization', implying a destructive mutation, but lacks details on permissions, reversibility, side effects, or error handling. This is inadequate for a destructive operation with zero annotation coverage.

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 front-loaded with the core purpose, followed by structured sections for Args and Returns. It's efficient with minimal waste, though the Returns section is vague ('Dictionary containing deletion result') and could be more informative.

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 a destructive tool with no annotations, 0% schema coverage, and an output schema present, the description is moderately complete. It covers the purpose and parameter semantics adequately but lacks behavioral details and usage guidelines, leaving gaps for safe agent operation.

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?

Schema description coverage is 0%, but the description compensates by explaining the single parameter 'optimization_id' as 'ID of the optimization to delete', adding clear meaning beyond the schema's title 'Optimization Id'. This is sufficient for the one parameter, though it doesn't cover format or constraints.

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 action ('Delete') and resource ('an optimization'), which is specific and unambiguous. It distinguishes from siblings like 'abort_optimization' or 'delete_backtest' by focusing on optimizations, though it doesn't explicitly contrast with them.

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 like 'abort_optimization' or 'delete_backtest', nor are there any prerequisites or context for deletion mentioned. The description only states what it does without usage context.

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