Skip to main content
Glama

delete_folder

Remove email folders to organize your mailbox by deleting specified folders from the Mail MCP Server.

Instructions

Delete an email folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folder_nameYesName of the folder to delete

Implementation Reference

  • The FolderManager.delete_folder method performs the actual IMAP delete operation on the server.
    def delete_folder(self, name: str) -> bool:
        """
        Delete a folder/mailbox.
    
        Args:
            name: Name of the folder to delete
    
        Returns:
            True if successful
    
        Raises:
            FolderNotFoundError: If folder does not exist
            FolderError: If operation fails
        """
        self._validate_folder_name(name)
    
        try:
            response = self._conn.delete(name)
    
            status = response[0]
            if status not in ("OK", b"OK"):
                error_msg = (
                    response[1][0].decode("utf-8", errors="replace")
                    if response[1]
                    else "Unknown error"
                )
    
                if "does not exist" in error_msg.lower() or "not found" in error_msg.lower():
                    raise FolderNotFoundError(f"Folder '{name}' does not exist")
    
                raise FolderError(f"Failed to delete folder: {error_msg}")
    
            return True
    
        except FolderError:
            raise
        except Exception as e:
            raise FolderError(f"Failed to delete folder: {str(e)}")
  • The IMAPClient.delete_folder method wraps the IMAP connection call to delete a folder.
    def delete_folder(self, folder_name: str) -> dict[str, Any]:
        """Delete a folder."""
        conn = self._ensure_connected()
        status, data = conn.delete(folder_name)
        self._check_status(status, data, "Failed to delete folder")
        return {"success": True, "folder": folder_name}
Behavior2/5

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

No annotations provided, so description carries full burden. While 'Delete' implies destruction, it fails to disclose whether deletion is permanent, recursive (affects subfolders/emails), or recoverable. Lacks safety-critical behavioral context expected for a destructive operation.

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

Conciseness3/5

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

Extremely terse at four words. While front-loaded and without wasted sentences, it is inappropriately brief for a destructive operation lacking annotations, omitting necessary warnings and behavioral constraints.

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?

Inadequate for a destructive tool with no annotations and no output schema. Missing crucial details: error conditions (folder not found, folder not empty), cascade behavior, and permission requirements.

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 100% (folder_name is fully described in schema). Description adds no additional parameter semantics beyond what the schema provides, meeting baseline expectations for high-coverage schemas.

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?

States a specific verb (Delete) and resource (email folder). Distinguishes implicitly from delete_email by specifying 'folder' and from file system folders by specifying 'email', though it does not explicitly contrast with sibling tools like rename_folder or create_folder.

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?

Provides no guidance on when to use versus alternatives, prerequisites (e.g., must the folder be empty?), or side effects. Critical safety information regarding content handling is absent.

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/AdJIa/mail-mcp-server'

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