smartlead_get_email_content
Retrieve email content details including raw and HTML versions along with campaign and sequence information for a specific spam test ID.
Instructions
Get details for the email content (raw, HTML) along with campaign and sequence details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spam_test_id | Yes | ID of the spam test to get the email content for |
Implementation Reference
- src/handlers/smartDelivery.ts:797-836 (handler)Core execution logic for the smartlead_get_email_content tool. Validates arguments using isEmailContentParams, calls the SmartDelivery API GET /spam-test/report/{spam_test_id}/email-content endpoint, and formats the response as MCP tool result.async function handleGetEmailContent( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isEmailContentParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_get_email_content' ); } try { const smartDeliveryClient = createSmartDeliveryClient(apiClient); const { spam_test_id } = args; const response = await withRetry( async () => smartDeliveryClient.get(`/spam-test/report/${spam_test_id}/email-content`), 'get email content' ); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], isError: false, }; } catch (error: any) { return { content: [{ type: 'text', text: `API Error: ${error.response?.data?.message || error.message}` }], isError: true, }; } }
- src/tools/smartDelivery.ts:392-406 (schema)Tool schema definition specifying the name, description, category, and input schema (requires spam_test_id as integer). Used for MCP tool registration and validation.export const GET_EMAIL_CONTENT_TOOL: CategoryTool = { name: 'smartlead_get_email_content', description: 'Get details for the email content (raw, HTML) along with campaign and sequence details.', category: ToolCategory.SMART_DELIVERY, inputSchema: { type: 'object', properties: { spam_test_id: { type: 'integer', description: 'ID of the spam test to get the email content for', }, }, required: ['spam_test_id'], }, };
- src/index.ts:217-219 (registration)Registers the array of smartDeliveryTools (including smartlead_get_email_content schema) to the MCP tool registry if smartDelivery category is license-enabled.if (enabledCategories.smartDelivery) { toolRegistry.registerMany(smartDeliveryTools); }
- src/types/smartDelivery.ts:344-351 (schema)Runtime type guard function isEmailContentParams used in the handler for input validation, matching the tool inputSchema.export function isEmailContentParams(args: unknown): args is EmailContentParams { return ( typeof args === 'object' && args !== null && 'spam_test_id' in args && typeof (args as EmailContentParams).spam_test_id === 'number' ); }
- src/index.ts:354-356 (registration)Registers the category dispatcher handleSmartDeliveryTool for all SMART_DELIVERY tools, which routes to specific handlers based on tool name.case ToolCategory.SMART_DELIVERY: return await handleSmartDeliveryTool(name, toolArgs, apiClient, withRetry); case ToolCategory.WEBHOOKS: