scrape_linkedin
Extract LinkedIn profile data and posts with comments from any profile URL to gather professional insights and content analysis.
Instructions
Retrieves detailed profile data and posts with comments from a LinkedIn profile URL using RapidAPI. Each request costs 2 credits.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| linkedin_url | Yes | The LinkedIn profile URL to scrape. |
Implementation Reference
- src/tools/scrape-linkedin.ts:16-39 (handler)The main execution logic for the 'scrape_linkedin' tool, which scrapes LinkedIn profile data via RapidAPI.export const scrapeLinkedinTool = async ({ linkedin_url, }: ScrapeLinkedinParams) => { const apiUrl = new URL("https://search.linkd.inc/api/enrich/scrape"); apiUrl.searchParams.append("linkedin_url", linkedin_url); const response = await makeLinkdRequest(apiUrl.toString(), {}); const responseData = await response.json(); if (responseData.error) { throw new Error( `Failed to scrape LinkedIn profile: ${JSON.stringify(responseData.error)}` ); } return { content: [ { type: "text" as const, text: `profile scraping completed successfully: ${JSON.stringify(responseData, null, 2)}` } ] }; };
- src/tools/scrape-linkedin.ts:8-14 (schema)Zod schema and TypeScript type for input parameters of the scrape_linkedin tool.export const scrapeLinkedinSchema = { linkedin_url: z.string().describe("The LinkedIn profile URL to scrape."), }; type ScrapeLinkedinParams = { linkedin_url: string; };
- src/server_setup.ts:40-45 (registration)Registration of the 'scrape_linkedin' tool on the MCP server.server.tool( scrapeLinkedinName, scrapeLinkedinDescription, scrapeLinkedinSchema, scrapeLinkedinTool );
- src/tools/scrape-linkedin.ts:4-6 (helper)Name and description constants used for tool registration.export const scrapeLinkedinName = "scrape_linkedin"; export const scrapeLinkedinDescription = "Retrieves detailed profile data and posts with comments from a LinkedIn profile URL using RapidAPI. Each request costs 2 credits.";