Skip to main content
Glama

marketo_get_program_members

Retrieve program members (leads) from a Marketo program with pagination and optional field selection to control data output.

Instructions

Get members (leads) of a Marketo program. Supports pagination via nextPageToken and batchSize. Optionally specify which lead fields to return.

Input Schema

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

Implementation Reference

  • src/index.ts:7-7 (registration)
    Imports registerProgramTools, which registers the marketo_get_program_members tool.
    import { registerProgramTools } from "./tools/programs.js";
  • src/index.ts:23-23 (registration)
    Calls registerProgramTools(server) to register all program tools including marketo_get_program_members.
    registerProgramTools(server);
  • Defines the marketo_get_program_members tool. Accepts programId (required), fields, batchSize, and nextPageToken. Makes a GET request to /rest/v1/leads/programs/{programId}.json.
    // ── marketo_get_program_members ────────────────────────────────────────────
    server.tool(
      "marketo_get_program_members",
      "Get members (leads) of a Marketo program. Supports pagination via nextPageToken and batchSize. Optionally specify which lead fields to return.",
      {
        programId: z.number().describe("Program 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/leads/programs/${args.programId}.json`, "GET", params));
        } catch (e) { return err(e); }
      }
    );
  • Zod schema for input validation: programId (number, required), fields (array of strings, optional), batchSize (number, optional), nextPageToken (string, optional).
    {
      programId: z.number().describe("Program 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"),
    },
  • The makeRequest helper that sends authenticated HTTP requests to the Marketo API. Used by the handler to call GET /rest/v1/leads/programs/{programId}.json.
    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;
    }
Behavior3/5

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

The description notes pagination support and optional field selection, but these are already detailed in the schema. No annotations are provided, so the description carries the burden; it does not disclose potential side effects, rate limits, or authentication needs.

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?

The description is two sentences, front-loaded with the core purpose, and efficient. Every sentence adds value without redundancy.

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

Completeness4/5

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

The description covers the core functionality and pagination, but lacks typical usage examples or response structure hints. Given no output schema, some additional context on expected return format would improve completeness.

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?

Schema description coverage is 100%, with each parameter already described. The description restates pagination and optional fields without adding new semantic information beyond the schema, so 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 tool retrieves members (leads) of a Marketo program, specifying verb 'get' and resource 'members of a program'. It is distinct from sibling tools like get_programs or get_lead_by_id.

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 is provided on when to use this tool versus alternatives such as get_lead_by_id or get_programs. There is no mention of prerequisites or contexts where another tool would be more appropriate.

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