Skip to main content
Glama
by ggiraudon
GetFolderListTool.ts973 B
import { TypeOf, z } from "zod"; import { Tool } from "fastmcp" import { ImapControllerFactory } from "../factories/ImapControllerFactory.js"; import { MailFolder,MailFolderSchema } from "../models/MailFolder.js"; const GetFolderListInput = z.object({ // No input parameters needed for this tool }); 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 })) }); } }; export default GetFolderListTool;

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