smartlead_get_campaign_sequence
Retrieve email sequence data for a specific campaign to analyze email marketing performance and track communication flows.
Instructions
Fetch a campaign's sequence data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| campaign_id | Yes | ID of the campaign to fetch sequences for |
Implementation Reference
- src/handlers/campaign.ts:346-382 (handler)Handler function that validates input, calls Smartlead API endpoint `/campaigns/{campaign_id}/sequences`, formats response as JSON text, and handles errors.async function handleGetCampaignSequence( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isGetCampaignSequenceParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_get_campaign_sequence' ); } try { const response = await withRetry( async () => apiClient.get(`/campaigns/${args.campaign_id}/sequences`), 'get campaign sequence' ); 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/campaign.ts:239-253 (schema)Tool definition including name, description, category, and input schema requiring `campaign_id` (number).export const GET_CAMPAIGN_SEQUENCE_TOOL: CategoryTool = { name: 'smartlead_get_campaign_sequence', description: 'Fetch a campaign\'s sequence data.', category: ToolCategory.CAMPAIGN_MANAGEMENT, inputSchema: { type: 'object', properties: { campaign_id: { type: 'number', description: 'ID of the campaign to fetch sequences for', }, }, required: ['campaign_id'], }, };
- src/index.ts:197-199 (registration)Registers the campaignTools array (which includes smartlead_get_campaign_sequence) to the tool registry if campaignManagement category is enabled.if (enabledCategories.campaignManagement) { toolRegistry.registerMany(campaignTools); }
- src/types/campaign.ts:140-147 (schema)Runtime type guard/validator for input parameters, ensuring `campaign_id` is present and a number.export function isGetCampaignSequenceParams(args: unknown): args is GetCampaignSequenceParams { return ( typeof args === 'object' && args !== null && 'campaign_id' in args && typeof (args as { campaign_id: unknown }).campaign_id === 'number' ); }
- src/handlers/campaign.ts:48-50 (registration)Switch case in handleCampaignTool that routes 'smartlead_get_campaign_sequence' calls to the specific handler function.case 'smartlead_get_campaign_sequence': { return handleGetCampaignSequence(args, apiClient, withRetry); }