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
| Name | Required | Description | Default |
|---|---|---|---|
| profile | No | LinkedIn profile URL | |
| profileId | No | LinkedIn profile ID (faster) | |
| 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 comments (default: 10) |
Implementation Reference
- src/index.ts:710-732 (handler)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,
- src/index.ts:299-311 (schema)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: [], },
- src/index.ts:537-537 (helper)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>);