Skip to main content
Glama

delete_file

Remove the current file from the editor. This tool deletes files to manage workspace content and free up storage.

Instructions

Delete current file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'delete_file' MCP tool. It deletes the currently set file (via set_file tool) using os.remove, resets the current_file_path, and returns success or error status.
    @self.mcp.tool()
    async def delete_file() -> Dict[str, Any]:
        """
        Delete current file
        """
    
        if self.current_file_path is None:
            return {"error": "No file path is set. Use set_file first."}
    
        try:
            if not os.path.exists(self.current_file_path):
                return {"error": f"File '{self.current_file_path}' does not exist."}
    
            os.remove(self.current_file_path)
    
            deleted_path = self.current_file_path
    
            self.current_file_path = None
    
            return {
                "status": "success",
                "message": f"File '{deleted_path}' was successfully deleted.",
            }
        except Exception as e:
            return {"error": f"Error deleting file: {str(e)}"}
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose if deletion is permanent, requires permissions, has side effects, or what happens on success/failure. 'Delete' implies destructive mutation, but specifics are missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise at two words, front-loaded with the core action. Every word earns its place with no wasted text, though this brevity contributes to vagueness in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive mutation tool with no annotations, the description is incomplete. It lacks context on what 'current' means, deletion behavior, permissions, or output. The presence of an output schema helps, but the description doesn't leverage it to explain return values or error conditions.

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?

The tool has 0 parameters with 100% schema coverage, so no parameter documentation is needed. The description doesn't add param info, but that's appropriate here, meeting the baseline for zero-param tools.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Delete current file' clearly states the action (delete) and target (current file), but it's vague about what 'current' refers to in context. It doesn't distinguish this from potential sibling operations like 'overwrite' or 'cancel' that might also modify files.

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 'overwrite' or 'cancel'. The description implies it's for deletion but doesn't specify prerequisites, conditions, or what makes a file 'current'.

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/danielpodrazka/editor-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server