enrich_person
Enhance person profiles by adding data such as contact details, social media links, job titles, and company information using People Data Labs' comprehensive dataset.
Instructions
Enrich a person profile with additional data from People Data Labs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| company | No | Company name where the person works | |
| No | Email address of the person | ||
| location | No | Location of the person (city, state, country) | |
| min_likelihood | No | Minimum likelihood score (0-1) for the match | |
| name | No | Full name of the person | |
| phone | No | Phone number of the person | |
| profile | No | Social media profile URLs of the person | |
| title | No | Job title of the person |
Implementation Reference
- src/index.ts:463-493 (handler)The primary handler function for the 'enrich_person' tool. Validates input using isValidPersonEnrichArgs, constructs query parameters from arguments, calls the People Data Labs API at '/person/enrich', and returns the response as formatted JSON text.private async handleEnrichPerson(args: any) { if (!isValidPersonEnrichArgs(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid person enrichment parameters. Must provide at least one identifier (email, phone, name, or profile).' ); } const params: Record<string, any> = {}; // Add parameters to the request if (args.email) params.email = args.email; if (args.phone) params.phone = args.phone; if (args.name) params.name = args.name; if (args.profile) params.profile = args.profile; if (args.location) params.location = args.location; if (args.company) params.company = args.company; if (args.title) params.title = args.title; if (args.min_likelihood !== undefined) params.min_likelihood = args.min_likelihood; const response = await pdlApi.get('/person/enrich', { params }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; }
- src/index.ts:122-173 (schema)Tool registration in ListTools response including name, description, and detailed input schema requiring at least one of email, phone, name, or profile.{ name: 'enrich_person', description: 'Enrich a person profile with additional data from People Data Labs', inputSchema: { type: 'object', properties: { email: { type: 'string', description: 'Email address of the person', }, phone: { type: 'string', description: 'Phone number of the person', }, name: { type: 'string', description: 'Full name of the person', }, profile: { type: 'array', items: { type: 'string' }, description: 'Social media profile URLs of the person', }, location: { type: 'string', description: 'Location of the person (city, state, country)', }, company: { type: 'string', description: 'Company name where the person works', }, title: { type: 'string', description: 'Job title of the person', }, min_likelihood: { type: 'number', description: 'Minimum likelihood score (0-1) for the match', minimum: 0, maximum: 1, }, }, anyOf: [ { required: ['email'] }, { required: ['phone'] }, { required: ['name'] }, { required: ['profile'] }, ], }, },
- src/index.ts:29-60 (helper)Type guard validation function ensuring arguments are a valid object with at least one person identifier (email, phone, name, or profile array) and valid min_likelihood if provided.const isValidPersonEnrichArgs = (args: any): args is { email?: string; phone?: string; name?: string; profile?: string[]; location?: string; company?: string; title?: string; min_likelihood?: number; } => { if (typeof args !== 'object' || args === null) { return false; } // Check if at least one identifier is provided const hasIdentifier = typeof args.email === 'string' || typeof args.phone === 'string' || typeof args.name === 'string' || (Array.isArray(args.profile) && args.profile.length > 0); if (!hasIdentifier) { return false; } // Validate optional fields if present if (args.min_likelihood !== undefined && (typeof args.min_likelihood !== 'number' || args.min_likelihood < 0 || args.min_likelihood > 1)) { return false; } return true; };
- src/index.ts:396-397 (registration)Dispatch registration in the CallToolRequestSchema handler switch statement, routing calls to 'enrich_person' to the handleEnrichPerson method.case 'enrich_person': return await this.handleEnrichPerson(request.params.arguments);