reply_to_email
Respond to existing emails using the Instantly MCP Server by providing the email ID, account, subject, and body content for direct replies.
Instructions
Reply to an existing email. IMPORTANT: This can only be used to reply to existing emails, not to send new emails. You must provide the ID of an existing email to reply to. Use campaigns for sending new emails.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bcc_address_email_list | No | Comma-separated list of BCC email addresses (optional) | |
| body | Yes | Email body content (REQUIRED). Provide either html or text, or both. | |
| cc_address_email_list | No | Comma-separated list of CC email addresses (optional) | |
| eaccount | Yes | The email account to send from (REQUIRED). Must be an email address from list_accounts that exists in your workspace. | |
| reply_to_uuid | Yes | The ID of the email to reply to (REQUIRED). Get this from list_emails or get_email endpoints. | |
| subject | Yes | Reply subject line (REQUIRED). Usually starts with "Re: " |
Implementation Reference
- src/handlers/tool-executor.ts:975-1022 (handler)Main handler implementation for reply_to_email tool. Validates input parameters, constructs the reply payload, calls the Instantly.ai /emails/reply API endpoint to send the real email reply, and returns the result.case 'reply_to_email': { console.error('[Instantly MCP] ⚠️ CRITICAL: Executing reply_to_email - WILL SEND REAL EMAIL!'); // Strict validation of required parameters if (!args.reply_to_uuid) { throw new McpError(ErrorCode.InvalidParams, 'reply_to_uuid is required - the ID of the email to reply to'); } if (!args.eaccount) { throw new McpError(ErrorCode.InvalidParams, 'eaccount is required - the email account that will send the reply'); } if (!args.subject) { throw new McpError(ErrorCode.InvalidParams, 'subject is required - the subject line of the reply'); } if (!args.body) { throw new McpError(ErrorCode.InvalidParams, 'body is required - the content of the reply email'); } // Build the reply data according to API v2 specification const replyData = { reply_to_uuid: args.reply_to_uuid, eaccount: args.eaccount, subject: args.subject, body: args.body }; console.error(`[Instantly MCP] ⚠️ SENDING EMAIL REPLY with data: ${JSON.stringify(replyData, null, 2)}`); console.error(`[Instantly MCP] ⚠️ This will send a real email to real people!`); console.error(`[Instantly MCP] 🔧 Using endpoint: /emails/reply`); const replyResult = await makeInstantlyRequest('/emails/reply', { method: 'POST', body: replyData }, apiKey); return { content: [ { type: 'text', text: JSON.stringify({ success: true, reply: replyResult, message: '⚠️ Email reply sent successfully - REAL EMAIL WAS SENT!', warning: 'This tool sent an actual email reply to real recipients' }, null, 2) } ] }; }
- src/tools/email-tools.ts:53-74 (schema)Tool definition including name, description, annotations (destructive/confirmation hints), and inputSchema for reply_to_email. This is used for MCP tool registration.{ name: 'reply_to_email', title: 'Reply to Email', description: '🚨 SENDS REAL EMAIL! Confirm with user first. Cannot undo!', annotations: { destructiveHint: true, confirmationRequiredHint: true }, inputSchema: { type: 'object', properties: { reply_to_uuid: { type: 'string', description: 'Email UUID to reply to' }, eaccount: { type: 'string', description: 'Sender account (must be active)' }, subject: { type: 'string', description: 'Subject line' }, body: { type: 'object', properties: { html: { type: 'string' }, text: { type: 'string' } } } }, required: ['reply_to_uuid', 'eaccount', 'subject', 'body'] } },
- src/validation.ts:534-548 (schema)Zod validation schema (ReplyToEmailSchema) used for input validation of reply_to_email tool parameters.export const ReplyToEmailSchema = z.object({ reply_to_uuid: z.string() .min(1, { message: 'Reply to UUID cannot be empty' }) .refine( (val) => val !== 'test-uuid', 'reply_to_uuid must be a valid email ID. Use list_emails or get_email tools first to obtain a valid email UUID.' ), body: z.object({ html: z.string().optional(), text: z.string().optional() }).refine( (val) => val.html || val.text, 'Body must contain either html or text content' ) });
- src/tools/index.ts:49-55 (registration)Registration of emailTools (which includes reply_to_email) into the main TOOLS_DEFINITION array exported for MCP server registration.return [ ...accountTools, ...campaignTools, ...leadTools, ...emailTools, ...analyticsTools, ];
- src/validation.ts:766-768 (helper)Validation function for reply_to_email inputs, registered in TOOL_VALIDATORS map at line 833.export function validateReplyToEmailData(args: unknown): z.infer<typeof ReplyToEmailSchema> { return validateWithSchema(ReplyToEmailSchema, args, 'reply_to_email'); }