Skip to main content
Glama

marketo_get_lead_activities

Retrieve timestamped activity records for a specific lead, filterable by activity type IDs like Visit Web Page or Send Email. Supports pagination via nextPageToken for efficient log browsing.

Instructions

Get activity log for a specific lead. Filter by activity type IDs (e.g. 1=Visit Web Page, 6=Send Email). Supports pagination via nextPageToken. Returns timestamped activity records.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
leadIdYesLead ID to get activities for
activityTypeIdsNoFilter to specific activity type IDs
nextPageTokenNoPagination token from previous response
batchSizeNoNumber of results per page (max 300)

Implementation Reference

  • Tool registration for marketo_get_lead_activities. Calls server.tool() with name, description, Zod schema for leadId/activityTypeIds/nextPageToken/batchSize, and an async handler.
    // ── marketo_get_lead_activities ────────────────────────────────────────────
    server.tool(
      "marketo_get_lead_activities",
      "Get activity log for a specific lead. Filter by activity type IDs (e.g. 1=Visit Web Page, 6=Send Email). Supports pagination via nextPageToken. Returns timestamped activity records.",
      {
        leadId: z.number().describe("Lead ID to get activities for"),
        activityTypeIds: z.array(z.number()).optional().describe("Filter to specific activity type IDs"),
        nextPageToken: z.string().optional().describe("Pagination token from previous response"),
        batchSize: z.number().optional().describe("Number of results per page (max 300)"),
      },
      async (args) => {
        try {
          const params: Record<string, unknown> = {};
          if (args.activityTypeIds?.length) params.activityTypeIds = args.activityTypeIds.join(",");
          if (args.nextPageToken) params.nextPageToken = args.nextPageToken;
          if (args.batchSize) params.batchSize = args.batchSize;
          return ok(await makeRequest(`/rest/v1/activities/lead/${args.leadId}.json`, "GET", params));
        } catch (e) { return err(e); }
      }
    );
  • Async handler that builds query params (activityTypeIds joined as comma string, nextPageToken, batchSize) and calls makeRequest to GET /rest/v1/activities/lead/{leadId}.json. Returns result via ok() helper, catches errors via err().
    async (args) => {
      try {
        const params: Record<string, unknown> = {};
        if (args.activityTypeIds?.length) params.activityTypeIds = args.activityTypeIds.join(",");
        if (args.nextPageToken) params.nextPageToken = args.nextPageToken;
        if (args.batchSize) params.batchSize = args.batchSize;
        return ok(await makeRequest(`/rest/v1/activities/lead/${args.leadId}.json`, "GET", params));
      } catch (e) { return err(e); }
    }
  • Zod input schema: leadId (number, required), activityTypeIds (array of numbers, optional), nextPageToken (string, optional), batchSize (number, optional).
    {
      leadId: z.number().describe("Lead ID to get activities for"),
      activityTypeIds: z.array(z.number()).optional().describe("Filter to specific activity type IDs"),
      nextPageToken: z.string().optional().describe("Pagination token from previous response"),
      batchSize: z.number().optional().describe("Number of results per page (max 300)"),
    },
  • makeRequest function that handles authenticated HTTP requests to the Marketo API, used by the tool handler.
    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;
    }
  • ok() and err() response formatters that wrap results in the MCP content format.
    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?

No annotations provided; the description says it 'Get activity log' and 'Returns timestamped activity records' but does not disclose read-only nature, authentication needs, rate limits, or side effects, leaving transparency minimal.

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-load the main purpose and efficiently add filtering and pagination details without fluff.

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?

Despite no output schema, the description mentions 'timestamped activity records' but lacks detailed return format. For a tool with four parameters, it is adequate but not fully comprehensive.

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

Parameters4/5

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

With 100% schema coverage, the description adds value by providing examples for activityTypeIds (e.g., 1=Visit Web Page) and clarifying pagination use, going beyond the raw 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 'Get activity log for a specific lead' with additional details on filtering and pagination, distinguishing it from sibling tools like lead creation or email cloning.

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 mentions filtering by activity type IDs and pagination, but lacks explicit when-not or alternative tools. Usage context is clear but not exhaustive.

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