search_linkedin_posts
Find LinkedIn posts using keywords, content types, authors, industries, and date filters to gather relevant professional content and insights.
Instructions
Search for LinkedIn posts with various filters like keywords, content type, authors, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| author_industries | No | Industry URN, can be obtained in /linkedin/search/industries. Or industry name. | |
| author_title | No | Author job title. | |
| authors | No | Authors URN of posts | |
| content_type | No | Desired content type | |
| count | Yes | Max result count | |
| date_posted | No | Date posted | past-month |
| keywords | No | Any keyword for searching in the post. For exact search put desired keywords into brackets | |
| mentioned | No | Mentioned users URN in posts | |
| sort | No | Sort type | relevance |
| timeout | No | Max scrapping execution timeout (in seconds) |
Implementation Reference
- src/index.ts:477-495 (handler)The core handler function that prepares the request payload, makes an API call to the AnySite LinkedIn search posts endpoint, processes the response, logs activity, and handles errors appropriately.async ({ keywords, count, timeout, sort, date_posted }) => { const requestData: any = { timeout, keywords, count }; if (sort) requestData.sort = sort; if (date_posted) requestData.date_posted = date_posted; log("Starting LinkedIn posts search with:", JSON.stringify(requestData)); try { const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_SEARCH_POSTS, requestData); log(`Search complete, found ${response.length} results`); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] }; } catch (error) { log("LinkedIn search posts error:", error); return { content: [{ type: "text", text: `LinkedIn search posts API error: ${formatError(error)}` }], isError: true }; } }
- src/index.ts:470-475 (schema)Zod schema defining the input parameters for the search_linkedin_posts tool, including descriptions and defaults.{ keywords: z.string().describe("Search keywords"), count: z.number().default(10).describe("Max results"), timeout: z.number().default(300).describe("Timeout in seconds"), sort: z.string().optional().describe("Sort order"), date_posted: z.string().optional().describe("Date filter")
- src/index.ts:468-496 (registration)Complete MCP server.tool registration for 'search_linkedin_posts', including name, description, input schema, and handler implementation."search_linkedin_posts", "Search LinkedIn posts with keywords and filters", { keywords: z.string().describe("Search keywords"), count: z.number().default(10).describe("Max results"), timeout: z.number().default(300).describe("Timeout in seconds"), sort: z.string().optional().describe("Sort order"), date_posted: z.string().optional().describe("Date filter") }, async ({ keywords, count, timeout, sort, date_posted }) => { const requestData: any = { timeout, keywords, count }; if (sort) requestData.sort = sort; if (date_posted) requestData.date_posted = date_posted; log("Starting LinkedIn posts search with:", JSON.stringify(requestData)); try { const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_SEARCH_POSTS, requestData); log(`Search complete, found ${response.length} results`); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] }; } catch (error) { log("LinkedIn search posts error:", error); return { content: [{ type: "text", text: `LinkedIn search posts API error: ${formatError(error)}` }], isError: true }; } } );
- src/index.ts:28-28 (helper)API endpoint constant used by the tool handler for LinkedIn posts search.LINKEDIN_SEARCH_POSTS: "/api/linkedin/search/posts",
- src/types.ts:163-174 (schema)TypeScript interface defining the expected arguments for LinkedIn search posts, providing type safety and documentation.export interface LinkedinSearchPostsArgs { timeout?: number; keywords?: string; sort?: "relevance"; date_posted?: "past-month" | "past-week" | "past-24h"; content_type?: "videos" | "photos" | "jobs" | "live_videos" | "documents" | null; mentioned?: string[] | null; authors?: string[] | null; author_industries?: string[] | string | null; author_title?: string | null; count: number; }