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
| Name | Required | Description | Default |
|---|---|---|---|
| count | Yes | Max reactions to return | |
| timeout | No | Timeout in seconds | |
| urn | Yes | Post 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 }; } } );
- src/index.ts:533-547 (handler)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 }; }
- src/index.ts:528-532 (schema)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") },
- src/types.ts:94-98 (schema)TypeScript interface defining the arguments for get_linkedin_post_reactions.export interface GetLinkedinPostReactionsArgs { urn: string; count?: number; timeout?: number; }
- src/types.ts:586-595 (schema)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; }