smartlead_update_campaign_status
Change the status of an email marketing campaign by updating it to PAUSED, STOPPED, or START using the campaign ID.
Instructions
Update the status of a campaign. Use this specifically for changing a campaign's status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| campaign_id | Yes | ID of the campaign to update the status for | |
| status | Yes | New status for the campaign (must be in uppercase) |
Implementation Reference
- src/handlers/campaign.ts:190-228 (handler)The handler function that executes the tool logic: validates arguments using isUpdateCampaignStatusParams, extracts campaign_id and status, performs POST request to `/campaigns/${campaign_id}/status` via apiClient with retry logic, and returns the API response or error.async function handleUpdateCampaignStatus( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isUpdateCampaignStatusParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_update_campaign_status' ); } const { campaign_id, status } = args; try { const response = await withRetry( async () => apiClient.post(`/campaigns/${campaign_id}/status`, { status }), 'update campaign status' ); 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:98-117 (schema)Tool definition including name, description, category, and inputSchema for validation (campaign_id: number, status: enum ['PAUSED', 'STOPPED', 'START']).export const UPDATE_CAMPAIGN_STATUS_TOOL: CategoryTool = { name: 'smartlead_update_campaign_status', description: 'Update the status of a campaign. Use this specifically for changing a campaign\'s status.', category: ToolCategory.CAMPAIGN_MANAGEMENT, inputSchema: { type: 'object', properties: { campaign_id: { type: 'number', description: 'ID of the campaign to update the status for', }, status: { type: 'string', enum: ['PAUSED', 'STOPPED', 'START'], description: 'New status for the campaign (must be in uppercase)', }, }, required: ['campaign_id', 'status'], }, };
- src/types/campaign.ts:26-129 (schema)TypeScript interface and type guard function for input validation of the tool parameters.export interface UpdateCampaignStatusParams { campaign_id: number; status: 'PAUSED' | 'STOPPED' | 'START'; } export interface GetCampaignParams { campaign_id: number; } export interface GetCampaignSequenceParams { campaign_id: number; } export interface ListCampaignsParams { status?: 'active' | 'paused' | 'completed'; limit?: number; offset?: number; } export interface SaveCampaignSequenceParams { campaign_id: number; sequence: Array<{ seq_number: number; seq_delay_details: { delay_in_days: number; }; variant_distribution_type: 'MANUAL_EQUAL' | 'MANUAL_PERCENTAGE' | 'AI_EQUAL'; lead_distribution_percentage?: number; winning_metric_property?: 'OPEN_RATE' | 'CLICK_RATE' | 'REPLY_RATE' | 'POSITIVE_REPLY_RATE'; seq_variants: Array<{ subject: string; email_body: string; variant_label: string; id?: number; variant_distribution_percentage?: number; }>; }>; } // New interface definitions for remaining campaign management endpoints export interface GetCampaignsByLeadParams { lead_id: number; } export interface ExportCampaignLeadsParams { campaign_id: number; } export interface DeleteCampaignParams { campaign_id: number; } export interface GetCampaignAnalyticsByDateParams { campaign_id: number; start_date: string; end_date: string; } export interface GetCampaignSequenceAnalyticsParams { campaign_id: number; start_date: string; end_date: string; time_zone?: string; } // Type guards export function isCreateCampaignParams(args: unknown): args is CreateCampaignParams { return ( typeof args === 'object' && args !== null && 'name' in args && typeof (args as { name: unknown }).name === 'string' ); } export function isUpdateCampaignScheduleParams(args: unknown): args is UpdateCampaignScheduleParams { return ( typeof args === 'object' && args !== null && 'campaign_id' in args && typeof (args as { campaign_id: unknown }).campaign_id === 'number' ); } export function isUpdateCampaignSettingsParams(args: unknown): args is UpdateCampaignSettingsParams { return ( typeof args === 'object' && args !== null && 'campaign_id' in args && typeof (args as { campaign_id: unknown }).campaign_id === 'number' ); } export function isUpdateCampaignStatusParams(args: unknown): args is UpdateCampaignStatusParams { return ( typeof args === 'object' && args !== null && 'campaign_id' in args && typeof (args as { campaign_id: unknown }).campaign_id === 'number' && 'status' in args && typeof (args as { status: unknown }).status === 'string' && ['PAUSED', 'STOPPED', 'START'].includes((args as { status: string }).status) ); }
- src/index.ts:197-199 (registration)Registration of the campaignTools array (which includes UPDATE_CAMPAIGN_STATUS_TOOL) into the toolRegistry if campaignManagement category is enabled.if (enabledCategories.campaignManagement) { toolRegistry.registerMany(campaignTools); }
- src/handlers/campaign.ts:36-37 (registration)Dispatch case in handleCampaignTool switch statement that routes the tool call to the specific handler function.case 'smartlead_update_campaign_status': { return handleUpdateCampaignStatus(args, apiClient, withRetry);