Skip to main content
Glama
Jing-yilin

LinkedIn MCP Server

by Jing-yilin

search_companies

Search for companies on LinkedIn using keywords, location, size, and other filters. Returns cleaned company data in structured TOON format for analysis and integration.

Instructions

Search LinkedIn companies. Returns cleaned data in TOON format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchYesKeywords to search
locationNoFilter by location
geoIdNoFilter by LinkedIn Geo ID
companySizeNoFilter by size: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+
pageNoPage number
save_dirNoDirectory to save cleaned JSON data
max_itemsNoMaximum results (default: 10)

Implementation Reference

  • The main handler function that implements the search_companies tool. It builds search parameters from input args, calls the HarvestAPI endpoint '/company-search', cleans the response data using DataCleaners.cleanCompany, limits the number of results, and returns a formatted CallToolResult with TOON-encoded content, optional file save, and pagination info.
    private async searchCompanies(args: Record<string, any>): Promise<CallToolResult> { const params: Record<string, any> = { search: args.search }; if (args.location) params.location = args.location; if (args.geoId) params.geoId = args.geoId; if (args.companySize) params.companySize = args.companySize; if (args.page) params.page = args.page; const data = await this.makeRequest('/company-search', params); const maxItems = args.max_items || 10; const cleaned = (data.elements || []).slice(0, maxItems).map(DataCleaners.cleanCompany); return this.formatResponse(cleaned, { saveDir: args.save_dir, toolName: 'search_companies', pagination: data.pagination, }); }
  • src/index.ts:343-359 (registration)
    The tool registration entry in the ListToolsRequestSchema handler's tools array. Defines the tool name, description, and detailed input schema including required 'search' parameter and optional filters like location, geoId, companySize, pagination, and save options.
    { name: 'search_companies', description: 'Search LinkedIn companies. Returns cleaned data in TOON format.', inputSchema: { type: 'object', properties: { search: { type: 'string', description: 'Keywords to search' }, location: { type: 'string', description: 'Filter by location' }, geoId: { type: 'string', description: 'Filter by LinkedIn Geo ID' }, companySize: { type: 'string', description: 'Filter by size: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+' }, page: { type: 'integer', description: 'Page number', default: 1 }, save_dir: { type: 'string', description: 'Directory to save cleaned JSON data' }, max_items: { type: 'integer', description: 'Maximum results (default: 10)', default: 10 }, }, required: ['search'], }, } as Tool,
  • The input schema definition for the search_companies tool, specifying properties for search query, filters (location, geoId, companySize), pagination (page, max_items), and optional save_dir, with 'search' as the only required field.
    inputSchema: { type: 'object', properties: { search: { type: 'string', description: 'Keywords to search' }, location: { type: 'string', description: 'Filter by location' }, geoId: { type: 'string', description: 'Filter by LinkedIn Geo ID' }, companySize: { type: 'string', description: 'Filter by size: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+' }, page: { type: 'integer', description: 'Page number', default: 1 }, save_dir: { type: 'string', description: 'Directory to save cleaned JSON data' }, max_items: { type: 'integer', description: 'Maximum results (default: 10)', default: 10 }, }, required: ['search'], },
  • Helper function within DataCleaners object that cleans raw company data from the API response, extracting and simplifying key fields such as id, name, linkedinUrl, website, logo, description, employeeCount, followers, and headquarter location.
    cleanCompany(raw: any): any { if (!raw) return null; const hq = (raw.locations || []).find((l: any) => l.headquarter) || raw.locations?.[0]; return { id: raw.id, universalName: raw.universalName, linkedinUrl: raw.linkedinUrl, name: raw.name, website: raw.website, logo: raw.logo, description: raw.description, employeeCount: raw.employeeCount, followers: raw.followerCount, headquarter: hq?.parsed?.text || hq?.city, }; },
  • src/index.ts:540-540 (registration)
    The switch case in the CallToolRequestSchema handler that dispatches calls to the search_companies tool by invoking the searchCompanies method.
    case 'search_companies': return await this.searchCompanies(args as Record<string, any>);

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/Jing-yilin/linkedin-mcp-server'

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