Skip to main content
Glama
Jing-yilin

LinkedIn MCP Server

by Jing-yilin

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
NameRequiredDescriptionDefault
profileNoLinkedIn profile URL
profileIdNoLinkedIn profile ID (faster)
profilePublicIdentifierNoProfile public identifier
postedLimitNoFilter by time: 24h, week, month
pageNoPage number
paginationTokenNoPagination token
save_dirNoDirectory to save cleaned JSON data
max_itemsNoMaximum posts (default: 10)

Implementation Reference

  • 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, }); }
  • 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>);
  • 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, }; },

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