get_linkedin_user_comments
Retrieve LinkedIn user comments by providing a user URN to analyze engagement patterns and discussion activity on the platform.
Instructions
Get LinkedIn comments for a user by URN (must include prefix, example: fsd_profile:ACoAA...)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commented_after | No | Filter comments that created after the specified date. Accepts timestamp | |
| count | No | Max comments | |
| timeout | No | Timeout in seconds | |
| urn | Yes | User URN (must include prefix, example: fsd_profile:ACoAA...) |
Implementation Reference
- src/index.ts:438-463 (handler)Core execution logic for get_linkedin_user_comments tool: normalizes URN, validates format, calls AnySite API /api/linkedin/user/comments, returns JSON or error.async ({ urn, count, timeout, commented_after }) => { const normalizedURN = normalizeUserURN(urn); if (!isValidUserURN(normalizedURN)) { return { content: [{ type: "text", text: "Invalid URN format. Must start with 'fsd_profile:'" }], isError: true }; } log("Starting LinkedIn user comments lookup for urn:", normalizedURN); const requestData: any = { timeout, urn: normalizedURN, count }; if (commented_after !== undefined) { requestData.commented_after = commented_after; } try { const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_USER_COMMENTS, requestData); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] }; } catch (error) { log("LinkedIn user comments lookup error:", error); return { content: [{ type: "text", text: `LinkedIn user comments API error: ${formatError(error)}` }], isError: true }; } }
- src/index.ts:432-437 (schema)Zod input validation schema defining parameters for the tool.{ urn: z.string().describe("User URN (must include prefix)"), count: z.number().default(10).describe("Max comments"), timeout: z.number().default(300).describe("Timeout in seconds"), commented_after: z.number().optional().describe("Filter comments after timestamp") },
- src/index.ts:429-464 (registration)MCP server.tool registration including name, description, schema, and inline handler.server.tool( "get_linkedin_user_comments", "Get LinkedIn comments for a user by URN", { urn: z.string().describe("User URN (must include prefix)"), count: z.number().default(10).describe("Max comments"), timeout: z.number().default(300).describe("Timeout in seconds"), commented_after: z.number().optional().describe("Filter comments after timestamp") }, async ({ urn, count, timeout, commented_after }) => { const normalizedURN = normalizeUserURN(urn); if (!isValidUserURN(normalizedURN)) { return { content: [{ type: "text", text: "Invalid URN format. Must start with 'fsd_profile:'" }], isError: true }; } log("Starting LinkedIn user comments lookup for urn:", normalizedURN); const requestData: any = { timeout, urn: normalizedURN, count }; if (commented_after !== undefined) { requestData.commented_after = commented_after; } try { const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_USER_COMMENTS, requestData); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] }; } catch (error) { log("LinkedIn user comments lookup error:", error); return { content: [{ type: "text", text: `LinkedIn user comments API error: ${formatError(error)}` }], isError: true }; } } );
- src/index.ts:88-92 (helper)Helper to normalize LinkedIn user URN by prepending 'fsd_profile:' if missing.const normalizeUserURN = (urn: string): string => { if (!urn.includes("fsd_profile:")) { return `fsd_profile:${urn}`; } return urn;
- src/index.ts:27-27 (helper)API endpoint URL constant used in the tool's makeRequest call.LINKEDIN_USER_COMMENTS: "/api/linkedin/user/comments",