Skip to main content
Glama

get_form_leads

Retrieve leads submitted through a lead generation form. Specify form ID, filter fields, and paginate results as needed.

Instructions

Get leads submitted through a lead generation form.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
form_idYesLead form ID
fieldsNoComma-separated fields to return
limitNoNumber of results to return
afterNoPagination cursor for next page

Implementation Reference

  • The handler for 'get_form_leads' tool. Registers the tool via server.tool() with the name 'get_form_leads'. It accepts form_id (required), fields, limit (default 25), and after (pagination cursor). Makes a GET request to /{form_id}/leads via the AdsClient and returns the JSON response with rate limit info.
    server.tool(
      "get_form_leads",
      "Get leads submitted through a lead generation form.",
      {
        form_id: z.string().describe("Lead form ID"),
        fields: z.string().optional().describe("Comma-separated fields to return"),
        limit: z.number().optional().default(25).describe("Number of results to return"),
        after: z.string().optional().describe("Pagination cursor for next page"),
      },
      async ({ form_id, ...params }) => {
        try {
          const { data, rateLimit } = await client.get(`/${form_id}/leads`, { ...params });
          return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Input schema for 'get_form_leads' using Zod: form_id (string, required), fields (optional string), limit (optional number, default 25), after (optional string for pagination).
    {
      form_id: z.string().describe("Lead form ID"),
      fields: z.string().optional().describe("Comma-separated fields to return"),
      limit: z.number().optional().default(25).describe("Number of results to return"),
      after: z.string().optional().describe("Pagination cursor for next page"),
    },
  • Registration via server.tool() inside registerLeadTools(), which is called from src/index.ts at line 68.
    server.tool(
      "get_form_leads",
      "Get leads submitted through a lead generation form.",
      {
        form_id: z.string().describe("Lead form ID"),
        fields: z.string().optional().describe("Comma-separated fields to return"),
        limit: z.number().optional().default(25).describe("Number of results to return"),
        after: z.string().optional().describe("Pagination cursor for next page"),
      },
      async ({ form_id, ...params }) => {
        try {
          const { data, rateLimit } = await client.get(`/${form_id}/leads`, { ...params });
          return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • src/index.ts:68-68 (registration)
    Call site where registerLeadTools(server, client) is invoked, registering all lead tools including 'get_form_leads'.
    registerLeadTools(server, client);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. The description only implies a read operation but doesn't disclose behavioral traits such as pagination, error handling, or data freshness. The 'after' parameter hints at pagination but is not explained.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, front-loaded with purpose. No extraneous information. Concise but could be slightly expanded without losing efficiency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Missing details on return format, pagination behavior, field selection, and error scenarios. No output schema. For a tool with 4 parameters and no annotations, the description is incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% description coverage for all 4 parameters. The description adds no additional meaning beyond what the schema provides (e.g., form_id is self-explanatory). Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'get' and the resource 'leads submitted through a lead generation form'. It distinguishes this from sibling tools like 'get_lead' (single lead) and 'list_lead_forms' (list forms).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like 'get_adset_leads' or 'get_campaign_leads'. The description does not mention context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mikusnuz/meta-ads-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server