get_profile
Extract LinkedIn profile data using URLs, identifiers, or profile IDs to retrieve contact information, work history, and professional details in structured format.
Instructions
Get LinkedIn profile information by URL, public identifier, or profile ID. Returns cleaned data in TOON format.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | LinkedIn profile URL | |
| publicIdentifier | No | Public identifier (last part of LinkedIn URL) | |
| profileId | No | LinkedIn profile ID | |
| findEmail | No | Find email address for the profile | |
| includeAboutProfile | No | Include detailed about section | |
| save_dir | No | Directory to save cleaned JSON data | |
| max_items | No | Maximum items in arrays (default: 5) |
Implementation Reference
- src/index.ts:631-658 (handler)The primary handler function for the 'get_profile' tool. It constructs API parameters from inputs, calls the HarvestAPI /profile endpoint, cleans the response using DataCleaners.cleanProfile, applies max_items limits to arrays, and formats the output in TOON format.private async getProfile(args: Record<string, any>): Promise<CallToolResult> { const params: Record<string, any> = {}; if (args.url) params.url = args.url; if (args.publicIdentifier) params.publicIdentifier = args.publicIdentifier; if (args.profileId) params.profileId = args.profileId; if (args.findEmail) params.findEmail = args.findEmail; if (args.includeAboutProfile) params.includeAboutProfile = args.includeAboutProfile; if (!params.url && !params.publicIdentifier && !params.profileId) { throw new Error('At least one of url, publicIdentifier, or profileId is required'); } const data = await this.makeRequest('/profile', params); const maxItems = args.max_items || 5; const cleaned = DataCleaners.cleanProfile(data.element); if (cleaned) { if (cleaned.experience) cleaned.experience = cleaned.experience.slice(0, maxItems); if (cleaned.education) cleaned.education = cleaned.education.slice(0, maxItems); if (cleaned.skills) cleaned.skills = cleaned.skills.slice(0, maxItems); if (cleaned.certifications) cleaned.certifications = cleaned.certifications.slice(0, maxItems); } return this.formatResponse(cleaned, { saveDir: args.save_dir, toolName: 'get_profile', }); }
- src/index.ts:239-254 (registration)The tool registration in the ListTools response, defining name, description, and input schema.name: 'get_profile', description: 'Get LinkedIn profile information by URL, public identifier, or profile ID. Returns cleaned data in TOON format.', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'LinkedIn profile URL' }, publicIdentifier: { type: 'string', description: 'Public identifier (last part of LinkedIn URL)' }, profileId: { type: 'string', description: 'LinkedIn profile ID' }, findEmail: { type: 'boolean', description: 'Find email address for the profile', default: false }, includeAboutProfile: { type: 'boolean', description: 'Include detailed about section', default: false }, save_dir: { type: 'string', description: 'Directory to save cleaned JSON data' }, max_items: { type: 'integer', description: 'Maximum items in arrays (default: 5)', default: 5 }, }, required: [], }, } as Tool,
- src/index.ts:242-253 (schema)The input schema defining parameters for the get_profile tool, including url, publicIdentifier, profileId, etc.type: 'object', properties: { url: { type: 'string', description: 'LinkedIn profile URL' }, publicIdentifier: { type: 'string', description: 'Public identifier (last part of LinkedIn URL)' }, profileId: { type: 'string', description: 'LinkedIn profile ID' }, findEmail: { type: 'boolean', description: 'Find email address for the profile', default: false }, includeAboutProfile: { type: 'boolean', description: 'Include detailed about section', default: false }, save_dir: { type: 'string', description: 'Directory to save cleaned JSON data' }, max_items: { type: 'integer', description: 'Maximum items in arrays (default: 5)', default: 5 }, }, required: [], },
- src/index.ts:24-69 (helper)Helper function DataCleaners.cleanProfile that processes raw API response, extracts and cleans key fields like experience, education, skills, and returns a structured profile object.cleanProfile(raw: any): any { if (!raw) return null; const exp = (raw.experience || []).map((e: any) => ({ position: e.position, company: e.companyName, location: e.location, duration: e.duration, startDate: e.startDate?.text, endDate: e.endDate?.text, description: e.description, })); const edu = (raw.education || []).map((e: any) => ({ school: e.schoolName || e.title, degree: e.degree, field: e.fieldOfStudy, period: e.period || `${e.startDate?.year || ''}-${e.endDate?.year || ''}`.replace(/^-|-$/g, ''), })); const skills = (raw.skills || []).map((s: any) => s.name); const certs = (raw.certifications || []).map((c: any) => ({ title: c.title, issuedBy: c.issuedBy, issuedAt: c.issuedAt, })); return { id: raw.id, publicIdentifier: raw.publicIdentifier, linkedinUrl: raw.linkedinUrl, name: `${raw.firstName || ''} ${raw.lastName || ''}`.trim(), headline: raw.headline, about: raw.about, location: raw.location?.linkedinText, photo: raw.photo || raw.profilePicture?.url, premium: raw.premium, influencer: raw.influencer, verified: raw.verified, openToWork: raw.openToWork, hiring: raw.hiring, connections: raw.connectionsCount, followers: raw.followerCount, experience: exp, education: edu, skills: skills, certifications: certs, }; },
- src/index.ts:534-534 (registration)Dispatch case in CallToolRequestSchema handler that routes 'get_profile' calls to the getProfile method.case 'get_profile': return await this.getProfile(args as Record<string, any>);