Skip to main content
Glama

marketo_add_leads_to_list

Add leads to a Marketo static list by providing lead IDs, up to 300 per request.

Instructions

Add one or more leads to a static list by lead IDs. Max 300 leads per call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listIdYesStatic list ID
leadIdsYesArray of lead IDs to add (max 300)

Implementation Reference

  • The handler function that executes the 'marketo_add_leads_to_list' tool logic. It maps lead IDs to {id} objects, then POSTs to Marketo's /rest/v1/lists/{listId}/leads.json with an application/json content type.
      async (args) => {
        try {
          const input = args.leadIds.map(id => ({ id }));
          return ok(await makeRequest(
            `/rest/v1/lists/${args.listId}/leads.json`,
            "POST",
            { input },
            "application/json"
          ));
        } catch (e) { return err(e); }
      }
    );
  • Zod schema definitions for the tool: 'listId' (number) and 'leadIds' (array of numbers, max 300 leads per call).
    {
      listId: z.number().describe("Static list ID"),
      leadIds: z.array(z.number()).describe("Array of lead IDs to add (max 300)"),
    },
  • Registration of the tool via server.tool('marketo_add_leads_to_list', ...) inside the registerListTools() function.
    server.tool(
      "marketo_add_leads_to_list",
      "Add one or more leads to a static list by lead IDs. Max 300 leads per call.",
      {
        listId: z.number().describe("Static list ID"),
        leadIds: z.array(z.number()).describe("Array of lead IDs to add (max 300)"),
      },
      async (args) => {
        try {
          const input = args.leadIds.map(id => ({ id }));
          return ok(await makeRequest(
            `/rest/v1/lists/${args.listId}/leads.json`,
            "POST",
            { input },
            "application/json"
          ));
        } catch (e) { return err(e); }
      }
    );
  • src/index.ts:26-29 (registration)
    The registerListTools(server) call that wires up all list tools including marketo_add_leads_to_list.
    registerListTools(server);
    registerChannelTools(server);
    registerLandingPageTools(server);
    registerBulkExportTools(server);
  • The makeRequest helper function used by the handler to perform the authenticated HTTP request 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;
    }
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavior. It mentions a rate limit but lacks details on error handling, idempotency, or side effects, which is insufficient for a mutation tool.

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?

A single sentence that is concise and front-loaded with the core purpose, with no redundant information.

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?

For a simple mutation tool with no output schema, the description should cover success/failure behavior and prerequisites, but only provides a limit, leaving the agent without critical context.

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 both parameters documented. The description repeats the max lead count already in the schema, adding no new semantic information beyond what's in the schema.

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 action 'Add one or more leads to a static list by lead IDs' with a specific verb and resource, distinguishing it from sibling tools like marketo_remove_leads_from_list.

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

Usage Guidelines4/5

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

The description provides a clear usage constraint (max 300 leads per call) and implies when to use (adding leads to a static list), but does not explicitly mention when not to use or alternative tools.

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