enrich_company
Enhance company profiles by adding crucial data such as social media links, stock tickers, and website details. Input company name, website, profiles, or ticker for comprehensive enrichment.
Instructions
Enrich a company profile with additional data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name of the company | |
| profile | No | Social media profile URLs of the company | |
| ticker | No | Stock ticker symbol of the company | |
| website | No | Website of the company |
Implementation Reference
- src/index.ts:515-541 (handler)The main execution logic for the 'enrich_company' tool: validates arguments using isValidCompanyEnrichArgs, constructs query parameters, calls the People Data Labs /company/enrich API endpoint, and returns the response as formatted JSON.private async handleEnrichCompany(args: any) { if (!isValidCompanyEnrichArgs(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid company enrichment parameters. Must provide at least one identifier (name, website, profile, or ticker).' ); } const params: Record<string, any> = {}; // Add parameters to the request if (args.name) params.name = args.name; if (args.website) params.website = args.website; if (args.profile) params.profile = args.profile; if (args.ticker) params.ticker = args.ticker; const response = await pdlApi.get('/company/enrich', { params }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; }
- src/index.ts:220-253 (registration)Registers the 'enrich_company' tool in the MCP server's tool list, including name, description, and detailed input schema defining properties and required fields via anyOf.{ name: 'enrich_company', description: 'Enrich a company profile with additional data', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the company', }, website: { type: 'string', description: 'Website of the company', }, profile: { type: 'array', items: { type: 'string' }, description: 'Social media profile URLs of the company', }, ticker: { type: 'string', description: 'Stock ticker symbol of the company', }, }, anyOf: [ { required: ['name'] }, { required: ['website'] }, { required: ['profile'] }, { required: ['ticker'] }, ], }, },
- src/index.ts:62-80 (helper)Type guard function that validates company enrichment arguments, ensuring at least one identifier (name, website, profile, or ticker) is provided.const isValidCompanyEnrichArgs = (args: any): args is { name?: string; website?: string; profile?: string[]; ticker?: string; } => { if (typeof args !== 'object' || args === null) { return false; } // Check if at least one identifier is provided const hasIdentifier = typeof args.name === 'string' || typeof args.website === 'string' || (Array.isArray(args.profile) && args.profile.length > 0) || typeof args.ticker === 'string'; return hasIdentifier; };
- src/index.ts:404-405 (registration)Routes 'enrich_company' tool calls to the handleEnrichCompany method in the CallToolRequestSchema handler.case 'enrich_company': return await this.handleEnrichCompany(request.params.arguments);