Skip to main content
Glama
abhishekbhakat

mcp-server-code-assist

delete_file

Remove files from your codebase using this MCP server tool. Specify the file path to delete it and maintain project organization.

Instructions

Deletes a file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Core handler function for the 'delete_file' tool. Validates the path, moves the file to a timestamped trash directory instead of permanent deletion, and returns a confirmation message.
    async def delete_file(self, path: str) -> str:
        path = await self.validate_path(path)
        if not path.is_file():
            return f"Path not found: {path}"
    
        # Create trash directory
        trash_dir = path.parent / ".mcp_server_code_assist_trash"
        trash_dir.mkdir(exist_ok=True)
    
        # Move file to trash with timestamp to avoid conflicts
        from datetime import datetime
    
        timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
        trash_path = trash_dir / f"{path.name}_{timestamp}"
        path.rename(trash_path)
    
        return f"Moved file to trash: {trash_path}"
  • Pydantic model defining the input schema for the delete_file tool, requiring a 'path' parameter.
    class FileDelete(BaseModel):
        path: str | Path
  • Registers the 'delete_file' tool in the MCP server with name, description, and input schema.
    Tool(
        name=CodeAssistTools.DELETE_FILE,
        description="Deletes a file",
        inputSchema=FileDelete.model_json_schema(),
    ),
  • Enum constant defining the tool name 'delete_file'.
    DELETE_FILE = "delete_file"
  • MCP server tool call handler that invokes the delete_file method on file_tools instance.
    case CodeAssistTools.DELETE_FILE:
        model = FileDelete(path=arguments["path"])
        result = await file_tools.delete_file(model.path)
        return [TextContent(type="text", text=result)]
Behavior1/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. 'Deletes a file' implies a destructive, irreversible mutation, but the description doesn't specify whether deletion is permanent, requires specific permissions, has confirmation prompts, or what happens on success/failure. For a destructive tool with zero annotation coverage, this is critically inadequate.

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?

The description is extremely concise at just three words, with zero wasted language. It's front-loaded with the core action and resource. While it's too brief to be helpful, it earns full marks for conciseness as every word serves a purpose.

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

Completeness1/5

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

Given this is a destructive mutation tool with no annotations, 0% schema description coverage, no output schema, and multiple sibling tools that modify files, the description is completely inadequate. It doesn't address safety concerns, error conditions, return values, or differentiation from similar tools, leaving the agent with insufficient information to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter information beyond what the input schema provides. With 0% schema description coverage and 1 parameter ('path'), the description doesn't explain what 'path' represents (e.g., absolute vs relative, file system constraints), expected format, or examples. It fails to compensate for the schema's lack of descriptions.

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 verb ('Deletes') and resource ('a file'), making the purpose immediately understandable. It distinguishes this from sibling tools like 'create_file', 'read_file', or 'modify_file' by specifying a deletion operation. However, it doesn't specify whether this is permanent deletion or moves to trash, which would make it more specific.

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., file must exist), when not to use it (e.g., for directories - though 'create_directory' is a sibling), or alternatives like moving to trash if available. With sibling tools like 'modify_file' and 'rewrite_file' that also alter files, the lack of differentiation is a significant gap.

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/abhishekbhakat/mcp_server_code_assist'

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