li_get_leadgen_responses
Retrieve LinkedIn Lead Gen Form submission data including question responses and timestamps. Filter by form ID and date range. Use to reconcile leads with CRM, audit lead quality, or validate form integrations.
Instructions
Retrieve actual Lead Gen Form submission data from LinkedIn. Each response includes questionResponses with field-by-field values (first name, last name, email, company, job title, phone, etc.) and submission timestamp. Filter by lead_form_id and/or submitted_after/before date range. Use for lead-to-CRM reconciliation against SFDC or Marketo, for auditing lead quality, or for confirming that a form integration is capturing the right fields. NOTE: This endpoint returns PII — handle output as sensitive data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ad_account_id | No | ||
| lead_form_id | No | Filter to a specific Lead Gen Form (numeric ID or URN). | |
| submitted_after | No | ISO date (YYYY-MM-DD). Only include responses submitted on or after this date. | |
| submitted_before | No | ISO date (YYYY-MM-DD). Upper bound for submission date. | |
| page_size | No |
Implementation Reference
- src/index.ts:187-192 (registration)The tool 'li_get_leadgen_responses' is registered on the MCP server with its description, schema, and handler.
server.tool( "li_get_leadgen_responses", "Retrieve actual Lead Gen Form submission data from LinkedIn. Each response includes questionResponses with field-by-field values (first name, last name, email, company, job title, phone, etc.) and submission timestamp. Filter by lead_form_id and/or submitted_after/before date range. Use for lead-to-CRM reconciliation against SFDC or Marketo, for auditing lead quality, or for confirming that a form integration is capturing the right fields. NOTE: This endpoint returns PII — handle output as sensitive data.", getLeadgenResponsesSchema, async (args) => { try { return ok(await getLeadgenResponses(args)); } catch (e) { return err(e); } } ); - src/tools/leadgen.ts:46-58 (schema)Zod schema defining inputs: ad_account_id, lead_form_id, submitted_after, submitted_before, and page_size.
export const getLeadgenResponsesSchema = { ad_account_id: z.string().optional(), lead_form_id: z .string() .optional() .describe("Filter to a specific Lead Gen Form (numeric ID or URN)."), submitted_after: z .string() .optional() .describe("ISO date (YYYY-MM-DD). Only include responses submitted on or after this date."), submitted_before: z.string().optional().describe("ISO date (YYYY-MM-DD). Upper bound for submission date."), page_size: z.number().int().min(1).max(100).default(50), }; - src/tools/leadgen.ts:60-85 (handler)Handler function that builds query params (owner, leadForm URN, date range, pagination) and calls the LinkedIn API via liGet('/leadFormResponses', params).
export async function getLeadgenResponses(args: { ad_account_id?: string; lead_form_id?: string; submitted_after?: string; submitted_before?: string; page_size?: number; }) { const account = resolveAdAccount(args.ad_account_id); const params: Record<string, string | number> = { q: "owner", owner: account, count: args.page_size ?? 50, }; if (args.lead_form_id) { params["leadForm"] = urn("leadGenForm", args.lead_form_id); } if (args.submitted_after) { const t = Date.parse(args.submitted_after); if (!Number.isNaN(t)) params["submittedAtTimeRange.start"] = t; } if (args.submitted_before) { const t = Date.parse(args.submitted_before); if (!Number.isNaN(t)) params["submittedAtTimeRange.end"] = t; } return liGet("/leadFormResponses", params); } - src/tools/leadgen.ts:1-12 (helper)Imports helper utilities: liGet (API call), resolveAdAccount, urn, etc. from ../client.js
import { z } from "zod"; import { BASE_URL, dateRangeParam, DEFAULT_END, DEFAULT_START, liGet, liGetRaw, resolveAdAccount, resolveDate, urn, } from "../client.js";