get_linkedin_email_user
Retrieve LinkedIn user details and profile information by entering an email address to identify professional contacts and connections.
Instructions
Get LinkedIn user details by email
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Max results | |
| Yes | Email address | ||
| timeout | No | Timeout in seconds |
Implementation Reference
- src/index.ts:337-361 (handler)Primary handler implementation for the 'get_linkedin_email_user' tool. Registers the tool with MCP server, defines Zod input schema, performs API request to LinkedIn email endpoint via makeRequest, handles response and errors.server.tool( "get_linkedin_email_user", "Get LinkedIn user details by email", { email: z.string().describe("Email address"), count: z.number().default(5).describe("Max results"), timeout: z.number().default(300).describe("Timeout in seconds") }, async ({ email, count, timeout }) => { const requestData = { timeout, email, count }; log("Starting LinkedIn email lookup for:", email); try { const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_EMAIL, requestData); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] }; } catch (error) { log("LinkedIn email lookup error:", error); return { content: [{ type: "text", text: `LinkedIn email API error: ${formatError(error)}` }], isError: true }; } } );
- src/types.ts:25-29 (schema)TypeScript interface defining the input parameters for the Linkedin email user tool (though Zod schema is used inline in implementation).export interface LinkedinEmailUserArgs { email: string; count?: number; timeout?: number; }
- src/types.ts:462-471 (helper)Runtime type validation function for LinkedinEmailUserArgs input.export function isValidLinkedinEmailUserArgs( args: unknown ): args is LinkedinEmailUserArgs { if (typeof args !== "object" || args === null) return false; const obj = args as Record<string, unknown>; if (typeof obj.email !== "string" || !obj.email.trim()) return false; if (obj.count !== undefined && typeof obj.count !== "number") return false; if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false; return true; }
- src/index.ts:24-24 (helper)API endpoint configuration constant used by the tool handler for the backend request path.LINKEDIN_EMAIL: "/api/linkedin/email/user",
- src/index.ts:100-145 (helper)Shared HTTP request utility function used by the tool to call the AnySite API backend.const makeRequest = (endpoint: string, data: any, method: string = "POST"): Promise<any> => { return new Promise((resolve, reject) => { const url = new URL(endpoint, API_CONFIG.BASE_URL); const postData = JSON.stringify(data); const options = { hostname: url.hostname, port: url.port || 443, path: url.pathname, method: method, headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData), "access-token": API_KEY, ...(ACCOUNT_ID && { "x-account-id": ACCOUNT_ID }) } }; const req = https.request(options, (res) => { let responseData = ""; res.on("data", (chunk) => { responseData += chunk; }); res.on("end", () => { try { const parsed = JSON.parse(responseData); if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) { resolve(parsed); } else { reject(new Error(`API error ${res.statusCode}: ${JSON.stringify(parsed)}`)); } } catch (e) { reject(new Error(`Failed to parse response: ${responseData}`)); } }); }); req.on("error", (error) => { reject(error); }); req.write(postData); req.end(); }); };