get_leads
Retrieve a list of leads from Kommo CRM with options to specify limit and pagination for efficient lead management and integration.
Instructions
Get list of leads from Kommo CRM
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of leads to return (max 250) | |
| page | No | Page number for pagination |
Implementation Reference
- src/http-streamable.ts:768-781 (handler)Handler for the 'get_leads' tool. Extracts parameters (limit, page), calls KommoAPI.getLeads, and returns the leads data as a JSON string in the MCP response format.
case 'get_leads': const leadsLimit = args?.limit || 1000; const leadsPage = args?.page || 1; const leadsData = await kommoAPI.getLeads({ limit: leadsLimit, page: leadsPage }); result = { content: [ { type: 'text', text: JSON.stringify(leadsData, null, 2) } ] }; break; - src/http-streamable.ts:672-681 (schema)Input schema definition for the 'get_leads' tool, specifying optional limit and page parameters.
{ name: 'get_leads', description: 'Obter lista de leads do Kommo CRM', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Número máximo de leads (padrão: 1000)' }, page: { type: 'number', description: 'Página para paginação (padrão: 1)' } } } - src/http-streamable.ts:666-753 (registration)Registration of the 'get_leads' tool in the MCP tools/list endpoint response, listing it among available tools.
if (method === 'tools/list') { const response = { jsonrpc: '2.0', id, result: { tools: [ { name: 'get_leads', description: 'Obter lista de leads do Kommo CRM', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Número máximo de leads (padrão: 1000)' }, page: { type: 'number', description: 'Página para paginação (padrão: 1)' } } } }, { name: 'create_lead', description: 'Criar um novo lead no Kommo CRM', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Nome do lead' }, price: { type: 'number', description: 'Valor do lead' }, status_id: { type: 'number', description: 'ID do status' } }, required: ['name'] } }, { name: 'get_sales_report', description: 'Obter relatório de vendas do Kommo CRM', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Número máximo de leads (padrão: 1000)' }, page: { type: 'number', description: 'Página para paginação (padrão: 1)' } } } }, { name: 'get_contacts', description: 'Obter lista de contatos do Kommo CRM', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Número máximo de contatos (padrão: 1000)' }, page: { type: 'number', description: 'Página para paginação (padrão: 1)' } } } }, { name: 'get_companies', description: 'Obter lista de empresas do Kommo CRM', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Número máximo de empresas (padrão: 1000)' }, page: { type: 'number', description: 'Página para paginação (padrão: 1)' } } } }, { name: 'get_tasks', description: 'Obter lista de tarefas do Kommo CRM', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Número máximo de tarefas (padrão: 1000)' }, page: { type: 'number', description: 'Página para paginação (padrão: 1)' } } } }, { name: 'ask_kommo', description: 'Fazer perguntas inteligentes sobre dados do Kommo CRM usando IA conversacional', inputSchema: { type: 'object', properties: { question: { type: 'string', description: 'Pergunta sobre dados do Kommo CRM' } }, required: ['question'] } } ] } }; - src/kommo-api.ts:200-203 (helper)Helper method in KommoAPI class that makes the actual API request to fetch leads from Kommo CRM.
async getLeads(params?: any): Promise<{ _embedded: { leads: KommoLead[] } }> { const response = await this.client.get('/api/v4/leads', { params }); return response.data; } - src/kommo-api.ts:8-24 (schema)TypeScript interface defining the structure of a KommoLead object, used in the getLeads response.
export interface KommoLead { id: number; name: string; price: number; status_id: number; pipeline_id: number; created_at: number; updated_at: number; responsible_user_id: number; created_by: number; closed_at?: number; loss_reason_id?: number; source_id?: number; tags?: string[]; contacts?: KommoContact[]; companies?: KommoCompany[]; }