marketo_enqueue_bulk_export
Enqueue a previously created bulk export job to change its status from Created to Queued, initiating processing. Use with marketo_get_bulk_export_status to monitor progress.
Instructions
Enqueue a previously created bulk export job for processing. The job moves from Created to Queued status. Poll status with marketo_get_bulk_export_status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exportId | Yes | Export job ID returned from create |
Implementation Reference
- src/tools/bulkExport.ts:35-49 (handler)The tool handler for 'marketo_enqueue_bulk_export'. Takes an exportId string, sends a POST request to `/bulk/v1/leads/export/{exportId}/enqueue.json` to enqueue the bulk export job.
server.tool( "marketo_enqueue_bulk_export", "Enqueue a previously created bulk export job for processing. The job moves from Created to Queued status. Poll status with marketo_get_bulk_export_status.", { exportId: z.string().describe("Export job ID returned from create"), }, async (args) => { try { return ok(await makeRequest( `/bulk/v1/leads/export/${args.exportId}/enqueue.json`, "POST" )); } catch (e) { return err(e); } } ); - src/tools/bulkExport.ts:38-40 (schema)Input schema for the tool: requires a string 'exportId' described as the export job ID returned from create.
{ exportId: z.string().describe("Export job ID returned from create"), }, - src/index.ts:13-13 (registration)Import of the registerBulkExportTools function from the bulkExport module.
import { registerBulkExportTools } from "./tools/bulkExport.js"; - src/index.ts:29-29 (registration)Registration call: registerBulkExportTools(server) which registers the tool on the MCP server.
registerBulkExportTools(server); - src/client.ts:21-49 (helper)The makeRequest helper used by the handler to send 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; }