get_profile_posts
Retrieve and clean posts from LinkedIn profiles to analyze content, track updates, or extract data for research and monitoring purposes.
Instructions
Get posts from a LinkedIn profile. Returns cleaned data in TOON format.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| profile | No | LinkedIn profile URL | |
| profileId | No | LinkedIn profile ID (faster) | |
| profilePublicIdentifier | No | Profile public identifier | |
| postedLimit | No | Filter by time: 24h, week, month | |
| page | No | Page number | |
| paginationToken | No | Pagination token | |
| save_dir | No | Directory to save cleaned JSON data | |
| max_items | No | Maximum posts (default: 10) |
Implementation Reference
- src/index.ts:685-708 (handler)Core handler function executing the tool: constructs params from args, calls HarvestAPI /profile-posts endpoint, cleans and limits post data, formats TOON response with pagination.private async getProfilePosts(args: Record<string, any>): Promise<CallToolResult> { const params: Record<string, any> = {}; if (args.profile) params.profile = args.profile; if (args.profileId) params.profileId = args.profileId; if (args.profilePublicIdentifier) params.profilePublicIdentifier = args.profilePublicIdentifier; if (args.postedLimit) params.postedLimit = args.postedLimit; if (args.page) params.page = args.page; if (args.paginationToken) params.paginationToken = args.paginationToken; if (!params.profile && !params.profileId && !params.profilePublicIdentifier) { throw new Error('At least one of profile, profileId, or profilePublicIdentifier is required'); } const data = await this.makeRequest('/profile-posts', params); const maxItems = args.max_items || 10; const cleaned = (data.elements || []).slice(0, maxItems).map(DataCleaners.cleanPost); return this.formatResponse(cleaned, { saveDir: args.save_dir, toolName: 'get_profile_posts', pagination: data.pagination, }); }
- src/index.ts:281-294 (schema)Input schema defining parameters for the get_profile_posts tool, including profile identifiers, filters, pagination, and options.inputSchema: { type: 'object', properties: { profile: { type: 'string', description: 'LinkedIn profile URL' }, profileId: { type: 'string', description: 'LinkedIn profile ID (faster)' }, profilePublicIdentifier: { type: 'string', description: 'Profile public identifier' }, postedLimit: { type: 'string', description: 'Filter by time: 24h, week, month', enum: ['24h', 'week', 'month'] }, page: { type: 'integer', description: 'Page number', default: 1 }, paginationToken: { type: 'string', description: 'Pagination token' }, save_dir: { type: 'string', description: 'Directory to save cleaned JSON data' }, max_items: { type: 'integer', description: 'Maximum posts (default: 10)', default: 10 }, }, required: [], },
- src/index.ts:278-295 (registration)Tool definition registered in ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'get_profile_posts', description: 'Get posts from a LinkedIn profile. Returns cleaned data in TOON format.', inputSchema: { type: 'object', properties: { profile: { type: 'string', description: 'LinkedIn profile URL' }, profileId: { type: 'string', description: 'LinkedIn profile ID (faster)' }, profilePublicIdentifier: { type: 'string', description: 'Profile public identifier' }, postedLimit: { type: 'string', description: 'Filter by time: 24h, week, month', enum: ['24h', 'week', 'month'] }, page: { type: 'integer', description: 'Page number', default: 1 }, paginationToken: { type: 'string', description: 'Pagination token' }, save_dir: { type: 'string', description: 'Directory to save cleaned JSON data' }, max_items: { type: 'integer', description: 'Maximum posts (default: 10)', default: 10 }, }, required: [], }, } as Tool,
- src/index.ts:536-536 (registration)Dispatch case in CallToolRequestSchema switch statement that routes calls to the getProfilePosts handler.case 'get_profile_posts': return await this.getProfilePosts(args as Record<string, any>);
- src/index.ts:132-147 (helper)Data cleaning utility for post objects, used in get_profile_posts to structure raw API response data.cleanPost(raw: any): any { if (!raw) return null; return { id: raw.id, linkedinUrl: raw.linkedinUrl, content: raw.content, authorName: raw.author?.name, authorType: raw.author?.type, postedAgo: raw.postedAt?.postedAgoText || raw.postedAt?.postedAgoShort, likes: raw.engagement?.likes, comments: raw.engagement?.comments, shares: raw.engagement?.shares, hasVideo: !!raw.postVideo, hasImages: (raw.postImages?.length || 0) > 0, }; },