marketo_create_channel
Define program lifecycle stages by creating a Marketo channel with progression statuses, step order, and success flags for program type.
Instructions
Create a new channel in Marketo. Channels define program types and their progression statuses (e.g. Invited > Registered > Attended for a Webinar channel).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Channel name | |
| applicableProgramType | Yes | Program type this channel applies to (e.g. 'event', 'default', 'email') | |
| progressionStatuses | Yes | Ordered list of progression statuses |
Implementation Reference
- src/tools/channels.ts:51-61 (handler)The async handler that executes the 'marketo_create_channel' tool logic. It sends a POST request to /rest/asset/v1/channels.json with the args as body (application/json) via the makeRequest helper.
async (args) => { try { return ok(await makeRequest( "/rest/asset/v1/channels.json", "POST", args, "application/json" )); } catch (e) { return err(e); } } ); - src/tools/channels.ts:42-50 (schema)Zod schema defining the input parameters for marketo_create_channel: name (string), applicableProgramType (string), and progressionStatuses (array of objects with name, step, isSuccess).
{ name: z.string().describe("Channel name"), applicableProgramType: z.string().describe("Program type this channel applies to (e.g. 'event', 'default', 'email')"), progressionStatuses: z.array(z.object({ name: z.string().describe("Status name (e.g. 'Invited')"), step: z.number().describe("Step number (progression order)"), isSuccess: z.boolean().default(false).describe("Whether this status counts as success"), })).describe("Ordered list of progression statuses"), }, - src/tools/channels.ts:39-61 (registration)Registration of the tool via server.tool() under the name 'marketo_create_channel' within the registerChannelTools function.
server.tool( "marketo_create_channel", "Create a new channel in Marketo. Channels define program types and their progression statuses (e.g. Invited > Registered > Attended for a Webinar channel).", { name: z.string().describe("Channel name"), applicableProgramType: z.string().describe("Program type this channel applies to (e.g. 'event', 'default', 'email')"), progressionStatuses: z.array(z.object({ name: z.string().describe("Status name (e.g. 'Invited')"), step: z.number().describe("Step number (progression order)"), isSuccess: z.boolean().default(false).describe("Whether this status counts as success"), })).describe("Ordered list of progression statuses"), }, async (args) => { try { return ok(await makeRequest( "/rest/asset/v1/channels.json", "POST", args, "application/json" )); } catch (e) { return err(e); } } ); - src/index.ts:11-27 (registration)Import and invocation of registerChannelTools which registers all channel tools (including marketo_create_channel) on the MCP server.
import { registerChannelTools } from "./tools/channels.js"; import { registerLandingPageTools } from "./tools/landingPages.js"; import { registerBulkExportTools } from "./tools/bulkExport.js"; const server = new McpServer({ name: "marketo-mcp", version: "0.1.0", }); // Register all tool groups registerFormTools(server); registerLeadTools(server); registerProgramTools(server); registerEmailTools(server); registerSmartListTools(server); registerListTools(server); registerChannelTools(server); - src/client.ts:21-49 (helper)The makeRequest helper used by the handler to perform the HTTP POST call to the Marketo API. Also includes the ok/err response formatters used in the 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; }