smartlead_get_warmup_stats_by_email
Retrieve warmup statistics for the last 7 days to monitor email account performance and deliverability metrics.
Instructions
Fetch warmup stats for the last 7 days for a specific email account.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| email_account_id | Yes | ID of the email account to fetch warmup stats for |
Implementation Reference
- src/handlers/statistics.ts:142-180 (handler)Core handler function that performs input validation, API request to retrieve warmup statistics for the specified email account ID, handles errors, and formats the response as MCP content.async function handleWarmupStatsByEmail( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isWarmupStatsByEmailParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_get_warmup_stats_by_email' ); } const { email_account_id } = args; try { const response = await withRetry( async () => apiClient.get(`/email-accounts/${email_account_id}/warmup-stats`), 'get warmup stats by email' ); 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/statistics.ts:68-82 (schema)Tool definition including name, description, category, and JSON input schema for MCP tool registration.export const WARMUP_STATS_BY_EMAIL_TOOL: CategoryTool = { name: 'smartlead_get_warmup_stats_by_email', description: 'Fetch warmup stats for the last 7 days for a specific email account.', category: ToolCategory.CAMPAIGN_STATISTICS, inputSchema: { type: 'object', properties: { email_account_id: { type: 'number', description: 'ID of the email account to fetch warmup stats for', }, }, required: ['email_account_id'], }, };
- src/handlers/statistics.ts:30-32 (registration)Switch case registration that routes calls to this specific tool name to the handleWarmupStatsByEmail handler function.case 'smartlead_get_warmup_stats_by_email': { return handleWarmupStatsByEmail(args, apiClient, withRetry); }
- src/types/statistics.ts:132-140 (schema)Runtime type guard/validator for input parameters matching WarmupStatsByEmailParams interface.export function isWarmupStatsByEmailParams(args: unknown): args is WarmupStatsByEmailParams { if (typeof args !== 'object' || args === null) { return false; } const params = args as WarmupStatsByEmailParams; return typeof params.email_account_id === 'number'; }
- src/index.ts:212-214 (registration)Registers the array of statistics tools (including this one) to the tool registry if category is enabled.if (enabledCategories.campaignStatistics) { toolRegistry.registerMany(statisticsTools); }