Skip to main content
Glama

marketo_create_or_update_leads

Batch create or update up to 300 leads in Marketo using email dedup. Choose create, update, or upsert action to sync lead data.

Instructions

Batch create or update leads in Marketo. Upserts up to 300 leads per call. Uses 'email' as the default dedup field. Set action to createOnly, updateOnly, or createOrUpdate.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesArray of lead objects (max 300). Each must include a dedup key like 'email'.
actionNoSync actioncreateOrUpdate
lookupFieldNoField used for deduplicationemail

Implementation Reference

  • The async handler function that executes the logic for marketo_create_or_update_leads. It calls makeRequest to POST to /rest/v1/leads.json with the action, lookupField, and input array.
      async (args) => {
        try {
          return ok(await makeRequest("/rest/v1/leads.json", "POST", {
            action: args.action,
            lookupField: args.lookupField,
            input: args.input,
          }, "application/json"));
        } catch (e) { return err(e); }
      }
    );
  • Zod schema for the tool's input parameters: input (array of lead objects), action (enum: createOnly/updateOnly/createOrUpdate, default createOrUpdate), lookupField (string, default 'email').
      input: z.array(z.record(z.unknown())).describe("Array of lead objects (max 300). Each must include a dedup key like 'email'."),
      action: z.enum(["createOnly", "updateOnly", "createOrUpdate"]).default("createOrUpdate").describe("Sync action"),
      lookupField: z.string().default("email").describe("Field used for deduplication"),
    },
  • Registration of the tool on the MCP server via server.tool() with name 'marketo_create_or_update_leads' and its description.
    server.tool(
      "marketo_create_or_update_leads",
      "Batch create or update leads in Marketo. Upserts up to 300 leads per call. Uses 'email' as the default dedup field. Set action to createOnly, updateOnly, or createOrUpdate.",
      {
        input: z.array(z.record(z.unknown())).describe("Array of lead objects (max 300). Each must include a dedup key like 'email'."),
        action: z.enum(["createOnly", "updateOnly", "createOrUpdate"]).default("createOrUpdate").describe("Sync action"),
        lookupField: z.string().default("email").describe("Field used for deduplication"),
      },
      async (args) => {
        try {
          return ok(await makeRequest("/rest/v1/leads.json", "POST", {
            action: args.action,
            lookupField: args.lookupField,
            input: args.input,
          }, "application/json"));
        } catch (e) { return err(e); }
      }
    );
  • src/index.ts:22-29 (registration)
    Registration of the registerLeadTools function which registers all lead-related tools including marketo_create_or_update_leads.
    registerLeadTools(server);
    registerProgramTools(server);
    registerEmailTools(server);
    registerSmartListTools(server);
    registerListTools(server);
    registerChannelTools(server);
    registerLandingPageTools(server);
    registerBulkExportTools(server);
  • The makeRequest helper that executes authenticated HTTP requests to the Marketo REST API. Called by the tool handler with POST method and 'application/json' content type.
    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?

No annotations exist, so the description carries full burden. It discloses the upsert nature, batch limit, and default dedup field, but does not mention idempotency, error handling, response structure, or behavior when duplicates exist.

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?

Three short sentences, no fluff. The most important information (batch create/update, limit, default dedup, actions) is front-loaded.

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

Completeness3/5

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

Covers core functionality but lacks output info (e.g., response format, status per lead). No mention of prerequisites like authentication. Given no output schema, the description should provide more context on what the tool returns.

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 coverage is 100% with clear descriptions. The description adds value by reiterating the batch limit and default dedup field, and explaining the action enum, but does not significantly extend beyond what the schema already provides.

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 it performs batch create or update (upsert) of leads, specifies the batch size limit of 300, default dedup field, and three action modes. This clearly distinguishes it from sibling tools like marketo_delete_lead or marketo_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 Guidelines3/5

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

The description implies usage through the action options (createOnly, updateOnly, createOrUpdate), but does not explicitly state when to use each or when to avoid this tool in favor of alternatives. No guidance on prerequisites or error scenarios.

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