search_leads
Search and filter leads in the database to find prospects by name, email, company, or status. Returns paginated results with contact details and channel history for outreach planning.
Instructions
Search and filter leads in the database. Returns paginated results with name, email, company, status, and channel history.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search | No | Search by name, email, or company | |
| status | No | Filter by lead status | |
| page | No | Page number (default 1) | |
| limit | No | Results per page (default 20, max 100) |
Implementation Reference
- src/tools/leads.ts:23-31 (handler)The handler for 'search_leads' tool, which takes arguments and calls the API client method.
handler: async (args: Record<string, unknown>) => { const leads = await client.searchLeads({ search: args.search as string | undefined, status: args.status as string | undefined, page: args.page as number | undefined, limit: args.limit as number | undefined, }); return JSON.stringify(leads, null, 2); }, - src/tools/leads.ts:10-22 (schema)Input schema definition for 'search_leads' tool.
inputSchema: { type: 'object' as const, properties: { search: { type: 'string', description: 'Search by name, email, or company' }, status: { type: 'string', enum: ['found', 'contacted', 'engaged', 'replied', 'converted', 'excluded'], description: 'Filter by lead status', }, page: { type: 'number', description: 'Page number (default 1)' }, limit: { type: 'number', description: 'Results per page (default 20, max 100)' }, }, }, - src/api-client.ts:79-93 (helper)The API client method that performs the actual network request to search leads.
async searchLeads(opts: { search?: string; page?: number; limit?: number; status?: string; tags?: string[]; }) { const params = new URLSearchParams(); if (opts.search) params.set('search', opts.search); if (opts.page) params.set('page', String(opts.page)); if (opts.limit) params.set('limit', String(opts.limit)); if (opts.status) params.set('status', opts.status); if (opts.tags?.length) params.set('tags', opts.tags.join(',')); return this.request('GET', `/api/leads?${params.toString()}`); }