Skip to main content
Glama
Jing-yilin

LinkedIn MCP Server

by Jing-yilin

get_profile_comments

Retrieve LinkedIn profile comments with time filters and pagination for data analysis or monitoring.

Instructions

Get comments made by a LinkedIn profile. Returns cleaned data in TOON format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
profileNoLinkedIn profile URL
profileIdNoLinkedIn profile ID (faster)
postedLimitNoFilter by time: 24h, week, month
pageNoPage number
paginationTokenNoPagination token
save_dirNoDirectory to save cleaned JSON data
max_itemsNoMaximum comments (default: 10)

Implementation Reference

  • The handler function that implements the core logic of the 'get_profile_comments' tool. It constructs parameters from input args, validates required fields, makes an API request to '/profile-comments', cleans and limits the comment data, and formats the response using formatResponse.
    private async getProfileComments(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.postedLimit) params.postedLimit = args.postedLimit; if (args.page) params.page = args.page; if (args.paginationToken) params.paginationToken = args.paginationToken; if (!params.profile && !params.profileId) { throw new Error('At least one of profile or profileId is required'); } const data = await this.makeRequest('/profile-comments', params); const maxItems = args.max_items || 10; const cleaned = (data.elements || []).slice(0, maxItems).map(DataCleaners.cleanComment); return this.formatResponse(cleaned, { saveDir: args.save_dir, toolName: 'get_profile_comments', pagination: data.pagination, }); }
  • src/index.ts:296-312 (registration)
    The tool registration entry in the tools list provided to MCP server for listTools. Includes name, description, and inputSchema.
    { name: 'get_profile_comments', description: 'Get comments made by 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)' }, 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 comments (default: 10)', default: 10 }, }, required: [], }, } as Tool,
  • Input schema defining parameters for the tool, including profile URL/ID, time filters, pagination, save directory, and max items.
    inputSchema: { type: 'object', properties: { profile: { type: 'string', description: 'LinkedIn profile URL' }, profileId: { type: 'string', description: 'LinkedIn profile ID (faster)' }, 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 comments (default: 10)', default: 10 }, }, required: [], },
  • Switch case in the CallToolRequestHandler that dispatches calls to 'get_profile_comments' to the handler method.
    case 'get_profile_comments': return await this.getProfileComments(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