Skip to main content
Glama

get_linkedin_user_posts

Retrieve LinkedIn posts for specific users using their URN identifier to access and analyze professional content and updates.

Instructions

Get LinkedIn posts for a user by URN (must include prefix, example: fsd_profile:ACoAAEWn01QBWENVMWqyM3BHfa1A-xsvxjdaXsY)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoMax posts
timeoutNoTimeout in seconds
urnYesUser URN (must include prefix, example: fsd_profile:ACoAA...)

Implementation Reference

  • Tool registration with inline Zod schema for input validation and async handler function that normalizes/validates URN, makes HTTPS POST request to AnySite API endpoint for LinkedIn user posts, and returns JSON response or formatted error.
    server.tool(
      "get_linkedin_user_posts",
      "Get LinkedIn posts for a user by URN (must include prefix, example: fsd_profile:ACoAAEWn01Q...)",
      {
        urn: z.string().describe("User URN (must include prefix, example: fsd_profile:ACoAA...)"),
        count: z.number().default(10).describe("Max posts"),
        timeout: z.number().default(300).describe("Timeout in seconds")
      },
      async ({ urn, count, timeout }) => {
        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 posts lookup for urn:", normalizedURN);
        const requestData = { timeout, urn: normalizedURN, count };
        try {
          const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_USER_POSTS, requestData);
          return {
            content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
          };
        } catch (error) {
          log("LinkedIn user posts lookup error:", error);
          return {
            content: [{ type: "text", text: `LinkedIn user posts API error: ${formatError(error)}` }],
            isError: true
          };
        }
      }
    );
  • Zod input schema defining parameters: urn (string, required), count (number, default 10), timeout (number, default 300).
    {
      urn: z.string().describe("User URN (must include prefix, example: fsd_profile:ACoAA...)"),
      count: z.number().default(10).describe("Max posts"),
      timeout: z.number().default(300).describe("Timeout in seconds")
    },
  • Helper function 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;
    };
  • Helper function to validate if URN starts with 'fsd_profile:'.
    const isValidUserURN = (urn: string): boolean => {
      return urn.startsWith("fsd_profile:");
    };
  • API endpoint constant used in makeRequest call for this tool.
    LINKEDIN_USER_POSTS: "/api/linkedin/user/posts",

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