Skip to main content
Glama

delete_file

Remove files from QuantConnect projects to manage project organization and eliminate unnecessary content.

Instructions

Delete a file from a QuantConnect project.

Args: project_id: ID of the project containing the file to delete name: Name of the file to delete

Returns: Dictionary containing deletion result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'delete_file' tool. It authenticates with QuantConnect, prepares a request with project_id and file name, sends a POST to the 'files/delete' endpoint, and returns success/error based on the response.
    @mcp.tool()
    async def delete_file(project_id: int, name: str) -> Dict[str, Any]:
        """
        Delete a file from a QuantConnect project.
    
        Args:
            project_id: ID of the project containing the file to delete
            name: Name of the file 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 = {"projectId": project_id, "name": name}
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="files/delete", method="POST", json=request_data
            )
    
            # Parse response
            if response.status_code == 200:
                data = response.json()
    
                if data.get("success", False):
                    return {
                        "status": "success",
                        "project_id": project_id,
                        "file_name": name,
                        "message": f"Successfully deleted file '{name}' from project {project_id}",
                    }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "File deletion failed",
                        "details": errors,
                        "project_id": project_id,
                        "file_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 delete file: {str(e)}",
                "project_id": project_id,
                "file_name": name,
            }
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 deletes a file, implying a destructive mutation, but does not disclose critical behavioral traits such as permission requirements, whether deletion is permanent or reversible, error conditions (e.g., if the file doesn't exist), or rate limits. 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 well-structured and appropriately sized. It front-loads the purpose in a clear sentence, followed by concise parameter explanations and return value note. Every sentence adds value, with no wasted words, though minor improvements could enhance completeness.

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 complexity (destructive mutation with 2 parameters), lack of annotations, and presence of an output schema (which handles return values), the description is partially complete. It covers the basic purpose and parameters but misses behavioral context like safety warnings or error handling. The output schema reduces the need to explain returns, but more disclosure is warranted for a delete operation.

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 containing the file to delete' and 'name' as 'Name of the file to delete', which clarifies what each parameter represents. However, it does not provide format details (e.g., case sensitivity for 'name') or constraints, 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: 'Delete a file from a QuantConnect project.' It specifies the verb ('Delete') and resource ('a file from a QuantConnect project'), making the action unambiguous. However, it does not explicitly differentiate from sibling tools like 'delete_backtest' or 'delete_project', 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?

The description provides no guidance on when to use this tool versus alternatives. It lacks context about prerequisites (e.g., authentication status), exclusions (e.g., cannot delete read-only files), or comparisons to similar tools like 'delete_backtest'. This leaves the agent without usage direction.

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