Skip to main content
Glama

update_file_name

Change file names within QuantConnect projects to organize trading strategies and research files for better project management.

Instructions

Update the name of a file in a QuantConnect project.

Args: project_id: ID of the project containing the file old_file_name: Current name of the file new_name: New name for the file

Returns: Dictionary containing update result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
old_file_nameYes
new_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'update_file_name' tool. It is decorated with @mcp.tool() for automatic registration and implements the file renaming logic via QuantConnect API.
    @mcp.tool()
    async def update_file_name(
        project_id: int, old_file_name: str, new_name: str
    ) -> Dict[str, Any]:
        """
        Update the name of a file in a QuantConnect project.
    
        Args:
            project_id: ID of the project containing the file
            old_file_name: Current name of the file
            new_name: New name for the file
    
        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 = {
                "projectId": project_id,
                "oldFileName": old_file_name,
                "newName": new_name,
            }
    
            # Make API request
            response = await auth.make_authenticated_request(
                endpoint="files/update", 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,
                        "old_name": old_file_name,
                        "new_name": new_name,
                        "message": f"Successfully renamed file from '{old_file_name}' to '{new_name}' in project {project_id}",
                    }
                else:
                    # API returned success=false
                    errors = data.get("errors", ["Unknown error"])
                    return {
                        "status": "error",
                        "error": "File name update failed",
                        "details": errors,
                        "project_id": project_id,
                        "old_name": old_file_name,
                        "new_name": new_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 update file name: {str(e)}",
                "project_id": project_id,
                "old_name": old_file_name,
                "new_name": new_name,
            }
  • Invocation of register_file_tools(mcp) which defines and registers the update_file_name tool among file management tools.
    register_file_tools(mcp)
  • Invocation of register_file_tools(mcp) in the server initialization, which defines and registers the update_file_name tool.
    register_file_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 of behavioral disclosure. It states the tool updates a file name, implying a mutation operation, but doesn't disclose critical behavioral traits: whether it requires specific permissions, if the update is reversible, what happens on failure (e.g., if the old file name doesn't exist), or any rate limits. The mention of a return value ('Dictionary containing update result') is minimal and doesn't detail success/error outcomes.

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, followed by structured sections for Args and Returns. Every sentence earns its place, with no redundant information. However, the 'Returns' section is vague ('Dictionary containing update result'), which slightly reduces efficiency.

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 moderate complexity (a mutation operation with 3 parameters), no annotations, and an output schema present (implied by 'Has output schema: true'), the description is partially complete. It covers the purpose and parameters well but lacks behavioral details (e.g., error handling, permissions) and relies on the output schema for return values, which is acceptable but leaves gaps in usage context.

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%, so the description must compensate. It provides clear semantic explanations for all three parameters: 'project_id: ID of the project containing the file', 'old_file_name: Current name of the file', and 'new_name: New name for the file'. This adds meaningful context beyond the schema's basic titles and types, though it doesn't cover constraints like valid name formats or ID ranges.

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 a file in a QuantConnect project.' It specifies the verb ('update'), resource ('name of a file'), and context ('in a QuantConnect project'), distinguishing it from siblings like 'update_file_content' (which modifies content rather than name) and 'create_file' (which creates rather than renames). However, it doesn't explicitly differentiate from all siblings, such as 'update_project' (which updates project-level attributes).

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 file), exclusions (e.g., not for updating file content), or comparisons to siblings like 'update_file_content' or 'delete_file'. The agent must infer usage from the purpose alone, which is insufficient for optimal tool selection.

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