list_lead_lists
Retrieve and manage lead lists with pagination controls to organize and access contact data for email campaigns.
Instructions
List all lead lists with pagination
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of lists to return (1-100, default: 20) | |
| starting_after | No | ID of the last item from previous page for pagination |
Implementation Reference
- src/handlers/lead-handler.ts:473-501 (handler)Main handler function that implements the list_lead_lists tool logic. Builds query parameters from input args, makes API request to /lead-lists endpoint, processes response with pagination info, and returns formatted MCP response.async function handleListLeadLists(args: any, apiKey: string) { console.error('[Instantly MCP] 📋 Executing list_lead_lists...'); // Build query parameters from args const queryParams: any = { limit: args.limit || 100 // Default to 100 items per page (max pagination) }; if (args.starting_after !== undefined) queryParams.starting_after = args.starting_after; if (args.has_enrichment_task !== undefined) queryParams.has_enrichment_task = args.has_enrichment_task; if (args.search !== undefined) queryParams.search = args.search; console.error(`[Instantly MCP] 📤 Fetching lead lists with params: ${JSON.stringify(queryParams, null, 2)}`); const listsResult = await makeInstantlyRequest('/lead-lists', { params: queryParams }, apiKey); // Extract items and pagination info const items = listsResult.items || listsResult; const nextStartingAfter = listsResult.next_starting_after; return createMCPResponse({ success: true, lead_lists: items, next_starting_after: nextStartingAfter, total_returned: Array.isArray(items) ? items.length : 0, has_more: !!nextStartingAfter, message: 'Lead lists retrieved successfully' }); }
- src/tools/lead-tools.ts:101-115 (registration)Tool registration in leadTools array, defining name, title, description, annotations, and input schema for MCP tool registration.{ name: 'list_lead_lists', title: 'List Lead Lists', description: 'List lead lists with pagination and search', annotations: { readOnlyHint: true }, inputSchema: { type: 'object', properties: { limit: { type: 'number', description: '1-100, default: 100' }, starting_after: { type: 'string', description: 'Cursor from pagination' }, has_enrichment_task: { type: 'boolean' }, search: { type: 'string', description: 'Search by name' } } } },
- src/validation.ts:526-529 (schema)Zod schema definition for validating input parameters of list_lead_lists tool.export const ListLeadListsSchema = z.object({ limit: z.number().int().min(1).max(100).optional(), starting_after: z.string().optional() });