create_batch
Create batch email jobs to send personalized messages to multiple recipients using templates and variables.
Instructions
Create a batch email job to send to multiple recipients
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Batch job name | |
| from | Yes | Sender email address | |
| subject | No | Email subject (can include {{variables}}) | |
| html | No | HTML content (can include {{variables}}) | |
| text | No | Plain text content (optional) | |
| templateId | No | Template ID to use instead of html/text (optional) | |
| recipients | Yes | Array of recipients with optional per-recipient variables | |
| replyTo | No | Reply-to address (optional) |
Implementation Reference
- src/index.ts:462-470 (handler)The handler for the 'create_batch' tool. It sends a POST request to the GetMailer API endpoint '/api/batch' with the tool input arguments and returns the JSON response as text content.case 'create_batch': { const result = await apiRequest('/api/batch', { method: 'POST', body: JSON.stringify(args), }); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }], }; }
- src/index.ts:274-319 (schema)Input schema definition for the 'create_batch' tool, specifying the structure and requirements for batch email creation parameters.inputSchema: { type: 'object' as const, properties: { name: { type: 'string', description: 'Batch job name', }, from: { type: 'string', description: 'Sender email address', }, subject: { type: 'string', description: 'Email subject (can include {{variables}})', }, html: { type: 'string', description: 'HTML content (can include {{variables}})', }, text: { type: 'string', description: 'Plain text content (optional)', }, templateId: { type: 'string', description: 'Template ID to use instead of html/text (optional)', }, recipients: { type: 'array', items: { type: 'object', properties: { to: { type: 'string' }, variables: { type: 'object' }, }, required: ['to'], }, description: 'Array of recipients with optional per-recipient variables', }, replyTo: { type: 'string', description: 'Reply-to address (optional)', }, }, required: ['name', 'from', 'recipients'], },
- src/index.ts:271-320 (registration)Registration of the 'create_batch' tool in the MCP server's ListTools response, including name, description, and input schema.{ name: 'create_batch', description: 'Create a batch email job to send to multiple recipients', inputSchema: { type: 'object' as const, properties: { name: { type: 'string', description: 'Batch job name', }, from: { type: 'string', description: 'Sender email address', }, subject: { type: 'string', description: 'Email subject (can include {{variables}})', }, html: { type: 'string', description: 'HTML content (can include {{variables}})', }, text: { type: 'string', description: 'Plain text content (optional)', }, templateId: { type: 'string', description: 'Template ID to use instead of html/text (optional)', }, recipients: { type: 'array', items: { type: 'object', properties: { to: { type: 'string' }, variables: { type: 'object' }, }, required: ['to'], }, description: 'Array of recipients with optional per-recipient variables', }, replyTo: { type: 'string', description: 'Reply-to address (optional)', }, }, required: ['name', 'from', 'recipients'], }, },