search_profiles
Find LinkedIn profiles by name, company, location, or other filters to retrieve structured professional data for research, recruitment, or networking purposes.
Instructions
Search LinkedIn profiles by name, company, location. Returns cleaned data in TOON format.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search | Yes | Search profiles by name | |
| currentCompany | No | Filter by current company ID or URL | |
| pastCompany | No | Filter by past company ID or URL | |
| school | No | Filter by school ID or URL | |
| firstName | No | Filter by first name | |
| lastName | No | Filter by last name | |
| title | No | Filter by job title | |
| location | No | Filter by location text | |
| geoId | No | Filter by LinkedIn Geo ID | |
| industryId | No | Filter by industry ID | |
| page | No | Page number | |
| save_dir | No | Directory to save cleaned JSON data | |
| max_items | No | Maximum results (default: 10) |
Implementation Reference
- src/index.ts:660-683 (handler)The handler function that implements the core logic for the 'search_profiles' tool. It constructs search parameters, calls the HarvestAPI /profile-search endpoint via makeRequest, cleans the results using DataCleaners.cleanProfileSearchResult, limits results, and formats the output in TOON with optional saving and pagination.private async searchProfiles(args: Record<string, any>): Promise<CallToolResult> { const params: Record<string, any> = { search: args.search }; if (args.currentCompany) params.currentCompany = args.currentCompany; if (args.pastCompany) params.pastCompany = args.pastCompany; if (args.school) params.school = args.school; if (args.firstName) params.firstName = args.firstName; if (args.lastName) params.lastName = args.lastName; if (args.title) params.title = args.title; if (args.location) params.location = args.location; if (args.geoId) params.geoId = args.geoId; if (args.industryId) params.industryId = args.industryId; if (args.page) params.page = args.page; const data = await this.makeRequest('/profile-search', params); const maxItems = args.max_items || 10; const cleaned = (data.elements || []).slice(0, maxItems).map(DataCleaners.cleanProfileSearchResult); return this.formatResponse(cleaned, { saveDir: args.save_dir, toolName: 'search_profiles', pagination: data.pagination, }); }
- src/index.ts:256-277 (schema)The tool definition including name, description, and input schema for validation. Defines parameters for searching profiles with required 'search' field and optional filters.name: 'search_profiles', description: 'Search LinkedIn profiles by name, company, location. Returns cleaned data in TOON format.', inputSchema: { type: 'object', properties: { search: { type: 'string', description: 'Search profiles by name' }, currentCompany: { type: 'string', description: 'Filter by current company ID or URL' }, pastCompany: { type: 'string', description: 'Filter by past company ID or URL' }, school: { type: 'string', description: 'Filter by school ID or URL' }, firstName: { type: 'string', description: 'Filter by first name' }, lastName: { type: 'string', description: 'Filter by last name' }, title: { type: 'string', description: 'Filter by job title' }, location: { type: 'string', description: 'Filter by location text' }, geoId: { type: 'string', description: 'Filter by LinkedIn Geo ID' }, industryId: { type: 'string', description: 'Filter by industry ID' }, 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,
- src/index.ts:535-535 (registration)Registration in the CallToolRequestHandler switch statement that routes calls to the searchProfiles handler function.case 'search_profiles': return await this.searchProfiles(args as Record<string, any>);
- src/index.ts:71-81 (helper)Helper function cleanProfileSearchResult used by the handler to clean and simplify profile search results, extracting key fields like id, name, position, location.cleanProfileSearchResult(raw: any): any { if (!raw) return null; return { id: raw.id, name: raw.name, position: raw.position, location: raw.location?.linkedinText, linkedinUrl: raw.linkedinUrl, publicIdentifier: raw.publicIdentifier, }; },
- src/index.ts:680-680 (registration)Tool name reference used in formatResponse for saving output files.toolName: 'search_profiles',