Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_list_leads

Retrieve and filter email marketing leads from Smartlead campaigns by status, date range, or search terms to manage outreach lists.

Instructions

List leads with optional filtering by campaign or status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idNoFilter leads by campaign ID
end_dateNoFilter leads created before this date (YYYY-MM-DD format)
limitNoMaximum number of leads to return
offsetNoOffset for pagination
searchNoSearch term to filter leads
start_dateNoFilter leads created after this date (YYYY-MM-DD format)
statusNoFilter leads by status (e.g., "active", "unsubscribed", "bounced")

Implementation Reference

  • The handler function that executes the smartlead_list_leads tool: validates input with isListLeadsParams, builds URLSearchParams from optional filters, performs GET /leads API call with retry, returns JSON response or error.
    async function handleListLeads(
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isListLeadsParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_list_leads'
        );
      }
    
      try {
        // Build query parameters from args
        const params = new URLSearchParams();
        if (args.campaign_id !== undefined) {
          params.append('campaign_id', args.campaign_id.toString());
        }
        if (args.status !== undefined) {
          params.append('status', args.status);
        }
        if (args.limit !== undefined) {
          params.append('limit', args.limit.toString());
        }
        if (args.offset !== undefined) {
          params.append('offset', args.offset.toString());
        }
        if (args.search !== undefined) {
          params.append('search', args.search);
        }
        if (args.start_date !== undefined) {
          params.append('start_date', args.start_date);
        }
        if (args.end_date !== undefined) {
          params.append('end_date', args.end_date);
        }
    
        const response = await withRetry(
          async () => apiClient.get('/leads', { params }),
          'list leads'
        );
    
        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,
        };
      }
    }
  • Tool definition including name, description, category (LEAD_MANAGEMENT), and detailed inputSchema for optional filtering parameters.
    export const LIST_LEADS_TOOL: CategoryTool = {
      name: 'smartlead_list_leads',
      description: 'List leads with optional filtering by campaign or status.',
      category: ToolCategory.LEAD_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'Filter leads by campaign ID',
          },
          status: {
            type: 'string',
            description: 'Filter leads by status (e.g., "active", "unsubscribed", "bounced")',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of leads to return',
          },
          offset: {
            type: 'number',
            description: 'Offset for pagination',
          },
          search: {
            type: 'string',
            description: 'Search term to filter leads',
          },
          start_date: {
            type: 'string',
            description: 'Filter leads created after this date (YYYY-MM-DD format)',
          },
          end_date: {
            type: 'string',
            description: 'Filter leads created before this date (YYYY-MM-DD format)',
          },
        },
      },
    };
  • src/index.ts:207-209 (registration)
    Registers the leadTools array (including smartlead_list_leads) to the toolRegistry if leadManagement category is enabled by license.
    if (enabledCategories.leadManagement) {
      toolRegistry.registerMany(leadTools);
    }
  • src/index.ts:350-351 (registration)
    In the main CallToolRequest handler switch, dispatches LEAD_MANAGEMENT tools (including smartlead_list_leads) to handleLeadTool.
    case ToolCategory.LEAD_MANAGEMENT:
      return await handleLeadTool(name, toolArgs, apiClient, withRetry);
  • Type guard function isListLeadsParams validates input arguments match ListLeadsParams interface with optional fields of correct types.
    export function isListLeadsParams(args: unknown): args is ListLeadsParams {
      if (typeof args !== 'object' || args === null) {
        return false;
      }
    
      const params = args as ListLeadsParams;
      
      // Optional campaign_id must be a number if present
      if (params.campaign_id !== undefined && typeof params.campaign_id !== 'number') {
        return false;
      }
      
      // Optional status must be a string if present
      if (params.status !== undefined && typeof params.status !== 'string') {
        return false;
      }
      
      // Optional limit must be a number if present
      if (params.limit !== undefined && typeof params.limit !== 'number') {
        return false;
      }
      
      // Optional offset must be a number if present
      if (params.offset !== undefined && typeof params.offset !== 'number') {
        return false;
      }
      
      // Optional search must be a string if present
      if (params.search !== undefined && typeof params.search !== 'string') {
        return false;
      }
      
      // Optional start_date must be a string if present
      if (params.start_date !== undefined && typeof params.start_date !== 'string') {
        return false;
      }
      
      // Optional end_date must be a string if present
      if (params.end_date !== undefined && typeof params.end_date !== 'string') {
        return false;
      }
      
      return true;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions optional filtering but doesn't disclose key behaviors: whether this is a read-only operation, if it requires authentication, rate limits, pagination details (beyond offset/limit parameters), or what the output format looks like. For a list tool with 7 parameters, this leaves significant gaps in understanding how it behaves.

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 states the core purpose and key filtering options without any wasted words. It's front-loaded with the main action and appropriately sized for a list tool.

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 tool's complexity (7 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain the return format, error conditions, authentication requirements, or how it differs from other lead-related tools. For a list operation in a crowded toolset, more contextual information is needed to guide proper usage.

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?

Schema description coverage is 100%, so the schema fully documents all 7 parameters. The description adds minimal value by mentioning filtering by 'campaign or status', which only covers 2 of the 7 parameters. It doesn't provide additional context beyond what's in the schema, such as default values or parameter interactions, but the high schema coverage justifies the baseline score.

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 verb ('List') and resource ('leads'), making the purpose understandable. It also mentions optional filtering by campaign or status, which adds specificity. However, it doesn't explicitly differentiate from sibling tools like 'smartlead_get_lead' or 'smartlead_search_domain', which might have overlapping functionality.

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 many sibling tools like 'smartlead_get_lead' (single lead), 'smartlead_search_domain', and 'smartlead_export_campaign_leads', there's no indication of scenarios where this list tool is preferred or how it differs in scope or performance from other listing/search tools.

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