Skip to main content
Glama

marketo_get_lead_lists

Fetch lead members of a Marketo static list by list ID, with pagination support via nextPageToken and batchSize, returning selected fields.

Instructions

Get leads that are members of a specific static list. Supports pagination via nextPageToken and batchSize.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listIdYesStatic list ID
fieldsNoLead field API names to return
batchSizeNoNumber of results per page (max 300)
nextPageTokenNoPagination token from previous response

Implementation Reference

  • Registration of the 'marketo_get_lead_lists' tool via server.tool(), including its Zod schema definition and handler.
    export function registerListTools(server: McpServer) {
      // ── marketo_get_lead_lists ─────────────────────────────────────────────────
      server.tool(
        "marketo_get_lead_lists",
        "Get leads that are members of a specific static list. Supports pagination via nextPageToken and batchSize.",
        {
          listId: z.number().describe("Static list ID"),
          fields: z.array(z.string()).optional().describe("Lead field API names to return"),
          batchSize: z.number().optional().describe("Number of results per page (max 300)"),
          nextPageToken: z.string().optional().describe("Pagination token from previous response"),
        },
        async (args) => {
          try {
            const params: Record<string, unknown> = {};
            if (args.fields?.length) params.fields = args.fields.join(",");
            if (args.batchSize) params.batchSize = args.batchSize;
            if (args.nextPageToken) params.nextPageToken = args.nextPageToken;
            return ok(await makeRequest(`/rest/v1/lists/${args.listId}/leads.json`, "GET", params));
          } catch (e) { return err(e); }
        }
      );
  • Async handler function that constructs query parameters and calls makeRequest to GET /rest/v1/lists/{listId}/leads.json with optional fields, batchSize, and nextPageToken.
    async (args) => {
      try {
        const params: Record<string, unknown> = {};
        if (args.fields?.length) params.fields = args.fields.join(",");
        if (args.batchSize) params.batchSize = args.batchSize;
        if (args.nextPageToken) params.nextPageToken = args.nextPageToken;
        return ok(await makeRequest(`/rest/v1/lists/${args.listId}/leads.json`, "GET", params));
      } catch (e) { return err(e); }
    }
  • Zod schema defining input parameters: listId (required number), fields (optional string array), batchSize (optional number), nextPageToken (optional string).
    {
      listId: z.number().describe("Static list ID"),
      fields: z.array(z.string()).optional().describe("Lead field API names to return"),
      batchSize: z.number().optional().describe("Number of results per page (max 300)"),
      nextPageToken: z.string().optional().describe("Pagination token from previous response"),
    },
  • makeRequest helper function used by the handler to execute authenticated HTTP requests to the Marketo API.
    export async function makeRequest<T = unknown>(
      endpoint: string,
      method: Method = "GET",
      data?: unknown,
      contentType?: string,
    ): Promise<T> {
      const token = await getAccessToken();
      const config: AxiosRequestConfig = {
        url: `${MARKETO_BASE_URL}${endpoint}`,
        method,
        headers: {
          Authorization: `Bearer ${token}`,
          ...(contentType ? { "Content-Type": contentType } : {}),
        },
        ...(data && method !== "GET" ? { data } : {}),
        ...(data && method === "GET" ? { params: data } : {}),
      };
    
      const res = await axios(config);
      const body = res.data;
    
      // Marketo REST API returns errors inside the response body
      if (body?.errors?.length) {
        const e = body.errors[0];
        throw new MarketoError(`${e.code}: ${e.message}`, res.status);
      }
    
      return body as T;
    }
  • Response helpers ok() and err() used in the handler to format successful/error responses.
    export function ok(data: unknown) {
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
      };
    }
    
    export function err(e: unknown) {
      const msg = e instanceof Error ? e.message : String(e);
      return {
        isError: true,
        content: [{ type: "text" as const, text: `Error: ${msg}` }],
      };
    }
Behavior2/5

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

Bare minimum disclosure: mentions pagination but lacks details on response format, error handling, rate limits, or idempotency. No annotations to supplement.

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

Conciseness5/5

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

Two concise sentences, front-loaded with purpose. No unnecessary words.

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?

Despite low complexity, description omits return value, error conditions, and pagination workflow. No output schema or annotations to fill gaps.

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, so baseline is 3. Description adds no new parameter semantics beyond rephrasing pagination support. No additional context for fields or usage.

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?

Clearly states 'Get leads that are members of a specific static list', specifying the verb and resource. Distinguishes from siblings like marketo_get_program_members and marketo_get_smart_lists by focusing on static list membership.

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

Usage Guidelines3/5

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

Implicitly indicates usage for retrieving members of a static list, but does not explicitly guide when to use over siblings or mention prerequisites 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/ZLeventer/marketo-mcp-server'

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