smartlead_get_lead
Retrieve detailed information about a specific lead by providing its unique ID, enabling access to contact data for email marketing campaigns.
Instructions
Get details of a specific lead by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lead_id | Yes | ID of the lead to retrieve |
Implementation Reference
- src/handlers/lead.ts:110-146 (handler)Core handler function for 'smartlead_get_lead': validates input parameters using isGetLeadParams, fetches lead details via API GET /leads/{lead_id} with retry logic, returns JSON-formatted response or error message.async function handleGetLead( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isGetLeadParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_get_lead' ); } try { const response = await withRetry( async () => apiClient.get(`/leads/${args.lead_id}`), 'get lead' ); 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, }; } }
- src/tools/lead.ts:43-57 (schema)Tool definition including name, description, category, and input schema requiring 'lead_id' as a number.export const GET_LEAD_TOOL: CategoryTool = { name: 'smartlead_get_lead', description: 'Get details of a specific lead by ID.', category: ToolCategory.LEAD_MANAGEMENT, inputSchema: { type: 'object', properties: { lead_id: { type: 'number', description: 'ID of the lead to retrieve', }, }, required: ['lead_id'], }, };
- src/index.ts:207-209 (registration)Registers the array of lead tools (leadTools), which includes 'smartlead_get_lead', into the tool registry if leadManagement category is enabled.if (enabledCategories.leadManagement) { toolRegistry.registerMany(leadTools); }
- src/types/lead.ts:115-122 (schema)Runtime type guard (validator) for GetLeadParams, ensuring 'lead_id' is present and a number.export function isGetLeadParams(args: unknown): args is GetLeadParams { return ( typeof args === 'object' && args !== null && 'lead_id' in args && typeof (args as { lead_id: unknown }).lead_id === 'number' ); }
- src/index.ts:25-25 (registration)Imports the leadTools array containing the 'smartlead_get_lead' tool definition for registration.import { leadTools } from './tools/lead.js';