Skip to main content
Glama
AgentX-ai

Mailchimp MCP Server

by AgentX-ai

list_folders

Retrieve all campaign folders from Mailchimp to organize and manage email marketing content effectively.

Instructions

List all campaign folders

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler logic for the 'list_folders' tool within the handleToolCall switch statement. It calls the MailchimpService.listFolders() method, maps the results to include only id, name, and count, and returns the data as a formatted JSON text response.
    case "list_folders":
      const folders = await service.listFolders();
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              folders.folders.map((f) => ({
                id: f.id,
                name: f.name,
                count: f.count,
              })),
              null,
              2
            ),
          },
        ],
      };
  • The tool registration object defining the 'list_folders' tool, including its name, description, and input schema (which requires no parameters). This array is used by getToolDefinitions to expose the tool via MCP.
    {
      name: "list_folders",
      description: "List all campaign folders",
      inputSchema: {
        type: "object",
        properties: {},
        required: [],
      },
    },
  • TypeScript interface defining the structure of a Mailchimp folder object, used in the return type of listFolders() and mapped in the handler.
    export interface MailchimpFolder {
      id: string;
      name: string;
      count: number;
      _links?: Array<{
        rel: string;
        href: string;
        method: string;
        targetSchema?: string;
        schema?: string;
      }>;
    }
  • Helper method in MailchimpService that performs the actual API call to fetch campaign folders using makePaginatedRequest, invoked by the tool handler.
    async listFolders(): Promise<{ folders: MailchimpFolder[] }> {
      return await this.makePaginatedRequest("/campaign-folders", "name", "ASC");

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/AgentX-ai/mailchimp-mcp'

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