Skip to main content
Glama
AgentX-ai

Mailchimp MCP Server

by AgentX-ai

get_segment

Retrieve detailed information about a specific Mailchimp email list segment using list and segment IDs for targeted audience analysis.

Instructions

Get details of a specific segment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYesThe list ID
segment_idYesThe segment ID

Implementation Reference

  • The handler function that executes the core logic of fetching a Mailchimp segment by list ID and segment ID.
    async getSegment(
      listId: string,
      segmentId: number
    ): Promise<MailchimpSegment> {
      return await this.makeRequest(`/lists/${listId}/segments/${segmentId}`);
    }
  • Input schema and tool definition for the get_segment tool.
      name: "get_segment",
      description: "Get details of a specific segment",
      inputSchema: {
        type: "object",
        properties: {
          list_id: {
            type: "string",
            description: "The list ID",
          },
          segment_id: {
            type: "number",
            description: "The segment ID",
          },
        },
        required: ["list_id", "segment_id"],
      },
    },
  • Tool dispatch/registration in the handleToolCall switch statement, which calls the handler and returns the formatted response.
    case "get_segment":
      const segment = await service.getSegment(args.list_id, args.segment_id);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(segment, null, 2),
          },
        ],
      };
  • TypeScript interface defining the structure of a Mailchimp segment (output type).
    export interface MailchimpSegment {
      id: number;
      name: string;
      member_count: number;
      type: "saved" | "static" | "fuzzy";
      created_at: string;
      updated_at: string;
      options?: {
        match: "any" | "all";
        conditions: Array<{
          condition_type: string;
          op: string;
          field: string;
          value: string;
        }>;
      };
      list_id: string;
      _links?: Array<{
        rel: string;
        href: string;
        method: string;
        targetSchema?: string;
        schema?: string;
      }>;
    }

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