Skip to main content
Glama

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
NameRequiredDescriptionDefault
commented_afterNoFilter comments that created after the specified date. Accepts timestamp
countNoMax comments
timeoutNoTimeout in seconds
urnYesUser URN (must include prefix, example: fsd_profile:ACoAA...)

Implementation Reference

  • 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
        };
      }
    }
  • 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
          };
        }
      }
    );
  • 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;
  • API endpoint URL constant used in the tool's makeRequest call.
    LINKEDIN_USER_COMMENTS: "/api/linkedin/user/comments",

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/anysiteio/hdw-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server