Skip to main content
Glama

get_linkedin_post_reactions

Retrieve LinkedIn post reactions by providing the post URN to analyze engagement metrics and user interactions with the content.

Instructions

Get LinkedIn reactions for a post by URN

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countYesMax reactions to return
timeoutNoTimeout in seconds
urnYesPost URN, only activity urn type is allowed (example: activity:7234173400267538433)

Implementation Reference

  • src/index.ts:525-549 (registration)
    Registration of the 'get_linkedin_post_reactions' tool, including inline Zod schema and handler function that calls the AnySite API.
    server.tool(
      "get_linkedin_post_reactions",
      "Get LinkedIn post reactions",
      {
        urn: z.string().describe("Post URN"),
        count: z.number().default(50).describe("Max reactions"),
        timeout: z.number().default(300).describe("Timeout in seconds")
      },
      async ({ urn, count, timeout }) => {
        const requestData = { timeout, urn, count };
        log(`Starting LinkedIn post reactions lookup for: ${urn}`);
        try {
          const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_POST_REACTIONS, requestData);
          return {
            content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
          };
        } catch (error) {
          log("LinkedIn post reactions lookup error:", error);
          return {
            content: [{ type: "text", text: `LinkedIn post reactions API error: ${formatError(error)}` }],
            isError: true
          };
        }
      }
    );
  • The core handler function that prepares the request data and calls makeRequest to the /api/linkedin/post/reactions endpoint, handles response or error.
    async ({ urn, count, timeout }) => {
      const requestData = { timeout, urn, count };
      log(`Starting LinkedIn post reactions lookup for: ${urn}`);
      try {
        const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_POST_REACTIONS, requestData);
        return {
          content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
        };
      } catch (error) {
        log("LinkedIn post reactions lookup error:", error);
        return {
          content: [{ type: "text", text: `LinkedIn post reactions API error: ${formatError(error)}` }],
          isError: true
        };
      }
  • Inline Zod schema defining input parameters: urn (string, Post URN), count (number, default 50), timeout (number, default 300).
    {
      urn: z.string().describe("Post URN"),
      count: z.number().default(50).describe("Max reactions"),
      timeout: z.number().default(300).describe("Timeout in seconds")
    },
  • TypeScript interface defining the arguments for get_linkedin_post_reactions.
    export interface GetLinkedinPostReactionsArgs {
      urn: string;
      count?: number;
      timeout?: number;
    }
  • TypeScript validation function for GetLinkedinPostReactionsArgs, checks urn contains 'activity:', numbers for count/timeout.
    export function isValidGetLinkedinPostReactionsArgs(
      args: unknown
    ): args is GetLinkedinPostReactionsArgs {
      if (typeof args !== "object" || args === null) return false;
      const obj = args as Record<string, unknown>;
      if (typeof obj.urn !== "string" || !obj.urn.includes("activity:")) return false;
      if (obj.count !== undefined && typeof obj.count !== "number") return false;
      if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
      return true;
    }

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