Skip to main content
Glama

list_folders

Retrieve all email folders to organize and manage messages within the Mail MCP Server.

Instructions

List all email folders

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The list_folders method in FolderManager handles the IMAP list command to retrieve folders.
    def list_folders(self, directory: str = "", pattern: str = "*") -> list[str]:
        """
        List all folders matching the pattern.
    
        Uses IMAP LIST command to retrieve all mailboxes.
    
        Args:
            directory: Directory prefix (e.g., 'INBOX')
            pattern: Mailbox pattern (default '*' matches all)
    
        Returns:
            List of folder names
    
        Raises:
            FolderError: If the operation fails
    
        Example:
            >>> folders = manager.list_folders()
            >>> print(folders)
            ['INBOX', 'INBOX/Sent', 'INBOX/Drafts', 'Archive']
        """
        try:
            response = self._conn.list(directory, pattern)
    
            # 检查状态 (可能是 'OK' 或 b'OK')
            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"
                )
                raise FolderError(f"Failed to list folders: {error_msg}")
    
            return self._parse_folder_list(response)
    
        except Exception as e:
            if isinstance(e, FolderError):
                raise
            raise FolderError(f"Failed to list folders: {str(e)}")
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but fails to specify whether this is a read-only operation, what data structure is returned, whether it includes system folders (Inbox, Sent), or if there are pagination limits. The word 'all' implies comprehensiveness but doesn't define scope boundaries.

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 extremely concise at four words. While efficient and front-loaded, it may be overly terse given the absence of output schema and annotations. However, it avoids tautology and wastes no words.

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?

Given the lack of output schema and annotations, the description should explain what constitutes a 'folder' object in the return data (names, IDs, paths, hierarchy) and whether subfolders are flattened or nested. The current description leaves critical operational context undefined.

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 input schema contains zero parameters. According to the evaluation rubric, tools with no parameters receive a baseline score of 4, as there are no parameter semantics to clarify beyond what the schema already conveys (100% description coverage of empty schema).

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 uses a specific verb ('List') and resource ('email folders') that clearly conveys the tool's function. While it distinguishes itself implicitly from email-centric siblings (copy_email, send_email) by focusing on folders rather than messages, it lacks explicit differentiation from folder manipulation tools like create_folder or rename_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?

The description provides no guidance on when to use this tool versus alternatives. It does not indicate whether this retrieves all folders recursively, only top-level folders, or how it relates to the get_email operation which might also access folder metadata.

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