Skip to main content
Glama
ggiraudon

Email MCP Server

by ggiraudon

getFolderList

Retrieve a structured list of email folders from an IMAP account to organize and manage mailbox contents effectively.

Instructions

Returns a list of folders in the imap account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute handler function of the getFolderList tool, which connects to the IMAP controller and retrieves and formats the folder list.
    export const GetFolderListTool: Tool<any, typeof GetFolderListInput> = {
      name: "getFolderList",
      description: "Returns a list of folders in the imap account.",
      parameters: GetFolderListInput,
      async execute(params) {
        const controller = ImapControllerFactory.getInstance();
        await controller.connect();
        const folders: MailFolder[] = await controller.getFolderList();
        // Return as a JSON string to match the expected return type
        return JSON.stringify({
          folders: folders.map(f => ({
            name: f.name,
            path: f.path,
            flags: f.flags,
            delimiter: f.delimiter
          }))
        });
      }
    };
  • Zod input schema for the getFolderList tool (no parameters required).
    const GetFolderListInput = z.object({
      // No input parameters needed for this tool
    });
  • src/index.ts:50-50 (registration)
    Registration of the GetFolderListTool with the FastMCP server.
    server.addTool(GetFolderListTool);
  • ImapController.getFolderList() helper method that traverses the IMAP box structure to build the folder list.
    getFolderList(): Promise<MailFolder[]> {
        return new Promise((resolve, reject) => {
            this.imap.getBoxes((err: Error | null, boxes: any) => {
                if (err) return reject(err);
                const folders: MailFolder[] = [];
                const traverse = (boxObj: any, path = '') => {
                    for (const name in boxObj) {
                        const box = boxObj[name];
                        const fullPath = path ? path + box.delimiter + name : name;
                        // Validate with schema and push
                        folders.push(MailFolderSchema.parse({
                            name,
                            path: fullPath,
                            flags: box.flags,
                            delimiter: box.delimiter
                        }));
                        if (box.children) traverse(box.children, fullPath);
                    }
                };
                traverse(boxes);
                resolve(folders);
            });
        });
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool returns a list but doesn't specify format, pagination, ordering, error conditions, or whether it requires authentication. This leaves significant gaps in understanding how the tool behaves.

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 a single, clear sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core purpose and appropriately sized for a simple tool.

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 tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the returned list contains (e.g., folder names, IDs, properties), how results are structured, or any limitations. Given the lack of structured data, more context is needed.

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 description coverage, so the schema fully documents the absence of inputs. The description appropriately doesn't mention parameters, which is correct for a parameterless tool, earning a baseline score of 4.

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 action ('Returns a list') and resource ('folders in the imap account'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'search' or 'getMessageList' that might also return lists, so it's not fully 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 like 'search' or 'getMessageList', nor does it mention prerequisites or context for folder listing. It simply states what it does without indicating appropriate usage scenarios.

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/ggiraudon/emailMCPServer'

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