marketo_get_channels
List all Marketo channels with names, progression statuses, and applicability. Channels define program type taxonomy like Webinar or Tradeshow. Supports pagination via maxReturn and offset parameters.
Instructions
List all channels in Marketo. Channels define the program type taxonomy (e.g. Webinar, Tradeshow, Email Send). Returns channel names, progression statuses, and applicability.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxReturn | No | Max channels to return (1-200, default 20) | |
| offset | No | Pagination offset |
Implementation Reference
- src/tools/channels.ts:14-22 (handler)The async handler function for 'marketo_get_channels'. It calls makeRequest to GET /rest/asset/v1/channels.json with optional maxReturn and offset params, then returns the result via the ok helper.
async (args) => { try { const params: Record<string, unknown> = {}; if (args.maxReturn) params.maxReturn = args.maxReturn; if (args.offset) params.offset = args.offset; return ok(await makeRequest("/rest/asset/v1/channels.json", "GET", params)); } catch (e) { return err(e); } } ); - src/tools/channels.ts:10-13 (schema)Input schema for 'marketo_get_channels'. Defines two optional Zod parameters: maxReturn (number, limits results 1-200, default 20) and offset (number, pagination offset).
{ maxReturn: z.number().optional().describe("Max channels to return (1-200, default 20)"), offset: z.number().optional().describe("Pagination offset"), }, - src/tools/channels.ts:7-22 (registration)Registration of the 'marketo_get_channels' tool on the McpServer via server.tool(). The tool description explains it lists all channels defining Marketo's program type taxonomy.
server.tool( "marketo_get_channels", "List all channels in Marketo. Channels define the program type taxonomy (e.g. Webinar, Tradeshow, Email Send). Returns channel names, progression statuses, and applicability.", { maxReturn: z.number().optional().describe("Max channels to return (1-200, default 20)"), offset: z.number().optional().describe("Pagination offset"), }, async (args) => { try { const params: Record<string, unknown> = {}; if (args.maxReturn) params.maxReturn = args.maxReturn; if (args.offset) params.offset = args.offset; return ok(await makeRequest("/rest/asset/v1/channels.json", "GET", params)); } catch (e) { return err(e); } } ); - src/index.ts:12-29 (registration)Import and registration call: registerChannelTools(server) is imported from './tools/channels.js' and invoked, which registers the marketo_get_channels tool (along with others) on the MCP server.
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); registerLandingPageTools(server); registerBulkExportTools(server); - src/client.ts:21-48 (helper)The makeRequest helper that the handler delegates to. It authenticates (via getAccessToken), makes an HTTP request to the Marketo API endpoint, and returns the response body.
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;