get_template
Retrieve detailed information about a specific Mailchimp email template by providing its template ID for email marketing management.
Instructions
Get details of a specific template
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| template_id | Yes | The template ID |
Implementation Reference
- src/services/mailchimp.ts:240-242 (handler)The core handler function that executes the tool logic by making an API request to retrieve the specific Mailchimp template using the provided template ID.async getTemplate(templateId: number): Promise<MailchimpTemplate> { return await this.makeRequest(`/templates/${templateId}`); }
- src/tools/index.ts:848-857 (handler)The MCP tool dispatch handler case for 'get_template' that invokes the service method and formats the JSON response as MCP content.case "get_template": const template = await service.getTemplate(args.template_id); return { content: [ { type: "text", text: JSON.stringify(template, null, 2), }, ], };
- src/tools/index.ts:273-286 (schema)The input schema and metadata definition for the 'get_template' tool, including name, description, and required template_id parameter.{ name: "get_template", description: "Get details of a specific template", inputSchema: { type: "object", properties: { template_id: { type: "number", description: "The template ID", }, }, required: ["template_id"], }, },
- src/index.ts:52-74 (registration)MCP server registration of the CallToolRequest handler that routes tool calls (including get_template) to the handleToolCall function.server.setRequestHandler(CallToolRequestSchema, async (request) => { try { return await handleToolCall( mailchimpService, request.params.name, request.params.arguments ); } catch (error: any) { console.error("Mailchimp Error:", error); // Handle Mailchimp API errors if (error.message && error.message.includes("Mailchimp API Error:")) { throw new McpError(ErrorCode.InternalError, error.message); } // Handle other errors if (error instanceof Error) { throw new McpError(ErrorCode.InternalError, error.message); } throw new McpError(ErrorCode.InternalError, "An unexpected error occurred"); } });
- src/types/index.ts:509-529 (schema)TypeScript interface defining the structure of a MailchimpTemplate, used for type safety in the tool's return value.export interface MailchimpTemplate { id: number; type: "user" | "base" | "gallery"; name: string; drag_and_drop: boolean; responsive: boolean; category?: string; date_created: string; created_by: string; active: boolean; folder_id?: string; thumbnail?: string; share_url?: string; _links?: Array<{ rel: string; href: string; method: string; targetSchema?: string; schema?: string; }>; }