Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_export_campaign_leads

Export campaign lead data to CSV format for analysis or integration with other systems using the campaign ID.

Instructions

Export all leads data from a campaign as CSV.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to export leads from

Implementation Reference

  • The core handler function that validates the input parameters using isExportCampaignLeadsParams, makes a GET request to the Smartlead API endpoint `/campaigns/{campaign_id}/leads-export` with text response type, and returns the CSV data or handles errors.
    async function handleExportCampaignLeads(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isExportCampaignLeadsParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_export_campaign_leads'
        );
      }
    
      try {
        const response = await withRetry(
          async () => apiClient.get(`/campaigns/${args.campaign_id}/leads-export`, {
            responseType: 'text'
          }),
          'export campaign leads'
        );
    
        return {
          content: [
            {
              type: 'text',
              text: `CSV Data:\n${response.data}`,
            },
          ],
          isError: false,
        };
      } catch (error: any) {
        return {
          content: [{ 
            type: 'text', 
            text: `API Error: ${error.response?.data?.message || error.message}` 
          }],
          isError: true,
        };
      }
    }
  • The tool metadata definition including the exact name, description, category, and JSON schema for input validation (requires campaign_id as number). This is included in the campaignTools array for registration.
    export const EXPORT_CAMPAIGN_LEADS_TOOL: CategoryTool = {
      name: 'smartlead_export_campaign_leads',
      description: 'Export all leads data from a campaign as CSV.',
      category: ToolCategory.CAMPAIGN_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'ID of the campaign to export leads from',
          },
        },
        required: ['campaign_id'],
      },
    };
  • src/index.ts:197-199 (registration)
    Registers the entire campaignTools array (which includes the smartlead_export_campaign_leads tool) to the MCP tool registry if the campaignManagement category is enabled by license/features.
    if (enabledCategories.campaignManagement) {
      toolRegistry.registerMany(campaignTools);
    }
  • Switch case in handleCampaignTool that maps the tool name to the specific handler function.
    case 'smartlead_export_campaign_leads': {
      return handleExportCampaignLeads(args, apiClient, withRetry);
    }
  • src/index.ts:346-347 (registration)
    Top-level dispatch in MCP callTool handler that routes CAMPAIGN_MANAGEMENT category tools to handleCampaignTool based on tool metadata.
    case ToolCategory.CAMPAIGN_MANAGEMENT:
      return await handleCampaignTool(name, toolArgs, apiClient, withRetry);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool exports data as CSV but omits critical details: whether this is a read-only operation, if it requires specific permissions, potential rate limits, file size constraints, or how the CSV is delivered (e.g., as a download link or direct data). For a data export tool, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the key information ('Export all leads data from a campaign as CSV'). There is no wasted verbiage, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain the return value (e.g., CSV content or file reference), error conditions, or behavioral traits like data scope limitations. For a tool that likely involves data retrieval and formatting, this leaves too many unknowns for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'campaign_id' clearly documented in the schema. The description adds no additional semantic context beyond what the schema provides (e.g., format examples or constraints), so it meets the baseline score of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Export') and resource ('all leads data from a campaign as CSV'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'smartlead_download_campaign_data' or 'smartlead_get_campaign_lead_statistics', which might offer similar data in different formats or scopes, so it misses the highest score for sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'smartlead_download_campaign_data' and 'smartlead_get_campaign_lead_statistics', it's unclear if this is the preferred method for CSV exports or if there are specific scenarios (e.g., bulk data retrieval) where it should be chosen. This lack of context leaves usage ambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jonathan-politzki/smartlead-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server