enrich_by_email
Look up detailed person and company information using an email address. Returns verified business data including job title, company details, phone numbers, and social profiles.
Instructions
Look up detailed person and company information using an email address. Returns verified business data including job title, company details, phone numbers, and social profiles.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | The email address to enrich | ||
| include_company | No | Include company data in response | |
| include_social | No | Include social profile data in response |
Implementation Reference
- src/index.ts:72-105 (handler)The MCP tool handler function for 'enrich_by_email' that calls LeadFuzeClient.enrichByEmail, formats the response, and handles errors.async ({ email, include_company, include_social }) => { try { const client = getClient(); const response = await client.enrichByEmail({ email, include_company, include_social, }); const formattedResponse = formatEnrichmentResponse(response); return { content: [ { type: "text" as const, text: formattedResponse, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "An unknown error occurred"; return { content: [ { type: "text" as const, text: `Error enriching email: ${errorMessage}`, }, ], isError: true, }; } }
- src/index.ts:47-106 (registration)Registration of the 'enrich_by_email' MCP tool, including name, input schema, annotations, and handler.server.registerTool( "enrich_by_email", { title: "Email Enrichment", description: "Look up detailed person and company information using an email address. Returns verified business data including job title, company details, phone numbers, and social profiles.", inputSchema: { email: z.string().email().describe("The email address to enrich"), include_company: z .boolean() .default(true) .describe("Include company data in response"), include_social: z .boolean() .default(true) .describe("Include social profile data in response"), }, annotations: { title: "Email Enrichment", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }, async ({ email, include_company, include_social }) => { try { const client = getClient(); const response = await client.enrichByEmail({ email, include_company, include_social, }); const formattedResponse = formatEnrichmentResponse(response); return { content: [ { type: "text" as const, text: formattedResponse, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "An unknown error occurred"; return { content: [ { type: "text" as const, text: `Error enriching email: ${errorMessage}`, }, ], isError: true, }; } } );
- src/index.ts:53-63 (schema)Zod-based input schema for the enrich_by_email tool parameters.inputSchema: { email: z.string().email().describe("The email address to enrich"), include_company: z .boolean() .default(true) .describe("Include company data in response"), include_social: z .boolean() .default(true) .describe("Include social profile data in response"), },
- src/api/leadfuze-client.ts:60-69 (helper)LeadFuzeClient method implementing the core HTTP API call for email enrichment.async enrichByEmail(params: EmailEnrichmentParams): Promise<EnrichmentResponse> { return this.request<EnrichmentResponse>("/enrichment/email", { email: params.email, include_company: params.include_company ?? true, include_social: params.include_social ?? true, limit: 100, page: 1, cache_ttl: 600, }); }
- src/api/leadfuze-client.ts:122-226 (helper)Utility function to format the raw API enrichment response into human-readable markdown text for the MCP tool output.export function formatEnrichmentResponse(response: EnrichmentResponse): string { if (!response.success) { return "Error: The enrichment request was not successful."; } if (!response.data || (Array.isArray(response.data) && response.data.length === 0)) { return `No match found for: ${response.meta.input}\n\nNo credits were consumed for this lookup.\nTry searching with a different email or LinkedIn URL.`; } // Handle both single object and array responses const person = Array.isArray(response.data) ? response.data[0] : response.data; const lines: string[] = []; // Build display name from available data const displayName = person.full_name || [person.first_name, person.last_name].filter(Boolean).join(" ") || person.business_email || "Unknown"; // Person details lines.push(`Found: ${displayName}`); if (person.business_email) { const validationStatus = person.business_email_validation_status ? ` (${person.business_email_validation_status})` : ""; lines.push(`- Email: ${person.business_email}${validationStatus}`); } if (person.job_title && person.company?.name) { lines.push(`- Title: ${person.job_title} at ${person.company.name}`); } else if (person.job_title) { lines.push(`- Title: ${person.job_title}`); } if (person.seniority_level) { lines.push(`- Seniority: ${person.seniority_level}`); } if (person.department) { lines.push(`- Department: ${person.department}`); } // Location const location = person.full_address || [person.personal_city, person.personal_state].filter(Boolean).join(", "); if (location) { lines.push(`- Location: ${location}`); } // Phone numbers if (person.mobile_phone) { lines.push(`- Mobile: ${person.mobile_phone}`); } if (person.direct_number) { lines.push(`- Direct: ${person.direct_number}`); } // LinkedIn if (person.linkedin_url) { lines.push(`- LinkedIn: ${person.linkedin_url}`); } // Company details if (person.company) { const company = person.company; lines.push(""); lines.push(`Company: ${company.name || "Unknown"}`); if (company.primary_industry) { lines.push(`- Industry: ${company.primary_industry}`); } if (company.employee_count) { lines.push(`- Size: ${company.employee_count} employees`); } if (company.revenue) { lines.push(`- Revenue: ${company.revenue}`); } if (company.domain) { lines.push(`- Website: ${company.domain}`); } const companyLocation = [company.city, company.state, company.country] .filter(Boolean) .join(", "); if (companyLocation) { lines.push(`- Location: ${companyLocation}`); } if (company.phone && company.phone.length > 0) { lines.push(`- Phone: ${company.phone[0]}`); } if (company.linkedin_url) { lines.push(`- LinkedIn: ${company.linkedin_url}`); } } // Add raw data for completeness lines.push(""); lines.push("--- Raw Data ---"); lines.push(JSON.stringify(response.data, null, 2)); return lines.join("\n"); }