Skip to main content
Glama
adamanz

Apollo.io MCP Server

by adamanz

employees_of_company

Find employees at any company by entering the company name, website URL, or LinkedIn URL to access professional contact information and organizational details.

Instructions

Find employees of a company using company name or website/LinkedIn URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyYesCompany name
website_urlNoCompany website URL
linkedin_urlNoCompany LinkedIn URL

Implementation Reference

  • Core implementation of the employees_of_company tool: searches for the company by name (optionally filtering by URL), retrieves its ID, then searches for people/employees within that organization using Apollo.io APIs.
    async employeesOfCompany(query: EmployeesOfCompanyQuery): Promise<any> { try { const { company, website_url, linkedin_url } = query; if (!company) { throw new Error('Company name is required'); } const strippedWebsiteUrl = stripUrl(website_url); const strippedLinkedinUrl = stripUrl(linkedin_url); // First search for the company const companySearchPayload = { q_organization_name: company, page: 1, limit: 100 }; const mixedCompaniesResponse = await axios.post( 'https://api.apollo.io/v1/mixed_companies/search', companySearchPayload, { headers: { 'Content-Type': 'application/json', 'X-Api-Key': this.apiKey } } ); if (!mixedCompaniesResponse.data) { throw new Error('No data received from Apollo API'); } let organizations = mixedCompaniesResponse.data.organizations; if (organizations.length === 0) { throw new Error('No organizations found'); } // Filter companies by website or LinkedIn URL if provided const companyObjs = organizations.filter((item: any) => { const companyLinkedin = stripUrl(item.linkedin_url); const companyWebsite = stripUrl(item.website_url); if (strippedLinkedinUrl && companyLinkedin && companyLinkedin === strippedLinkedinUrl) { return true; } else if (strippedWebsiteUrl && companyWebsite && companyWebsite === strippedWebsiteUrl) { return true; } return false; }); // If we have filtered results, use the first one, otherwise use the first from the original search const companyObj = companyObjs.length > 0 ? companyObjs[0] : organizations[0]; const companyId = companyObj.id; if (!companyId) { throw new Error('Could not determine company ID'); } // Now search for employees const peopleSearchPayload: any = { organization_ids: [companyId], page: 1, limit: 100 }; // Add optional filters if provided in the tool config if (query.person_seniorities) { peopleSearchPayload.person_titles = (query.person_seniorities ?? '').split(',').map((item: string) => item.trim()); } if (query.contact_email_status) { peopleSearchPayload.contact_email_status_v2 = (query.contact_email_status ?? '').split(',').map((item: string) => item.trim()); } const peopleResponse = await axios.post( 'https://api.apollo.io/v1/mixed_people/search', peopleSearchPayload, { headers: { 'Content-Type': 'application/json', 'X-Api-Key': this.apiKey } } ); if (!peopleResponse.data) { throw new Error('No data received from Apollo API'); } return peopleResponse.data.people || []; } catch (error: any) { console.error(`Error finding employees: ${error.message}`); return null; } }
  • src/index.ts:200-221 (registration)
    MCP tool registration defining the name, description, and input schema for 'employees_of_company'.
    { name: 'employees_of_company', description: 'Find employees of a company using company name or website/LinkedIn URL', inputSchema: { type: 'object', properties: { company: { type: 'string', description: 'Company name' }, website_url: { type: 'string', description: 'Company website URL' }, linkedin_url: { type: 'string', description: 'Company LinkedIn URL' } }, required: ['company'] } }
  • MCP server request handler case that delegates execution to ApolloClient.employeesOfCompany and formats the response.
    case 'employees_of_company': { const result = await this.apollo.employeesOfCompany(args as any); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
  • TypeScript interface defining the input parameters for the employeesOfCompany method, matching the MCP tool schema.
    export interface EmployeesOfCompanyQuery { company: string; website_url?: string; linkedin_url?: string; [key: string]: any; }
  • Utility function to normalize URLs by stripping protocol, www, trailing slash, and lowercasing, used for matching company websites and LinkedIn URLs.
    const stripUrl = (url?: string): string | undefined => { if (!url) return undefined; try { // Remove protocol (http://, https://) let stripped = url.replace(/^https?:\/\//, ''); // Remove www. stripped = stripped.replace(/^www\./, ''); // Remove trailing slash stripped = stripped.replace(/\/$/, ''); // Convert to lowercase stripped = stripped.toLowerCase(); return stripped; } catch (error) { console.error('Error stripping URL:', error); return url; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adamanz/apollo-io-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server