marketo_get_channel_by_id
Fetch a specific Marketo channel by numeric ID to obtain its progression statuses and success mappings.
Instructions
Retrieve a single channel by its numeric ID. Returns the channel definition including progression statuses and their success mappings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes |
Implementation Reference
- src/index.ts:198-198 (handler)The handler function for marketo_get_channel_by_id. It extracts the channelId parameter and makes a GET request to /asset/v1/channel/{channelId}.json to retrieve a single channel.
tool(async ({ channelId }) => makeApiRequest(`/asset/v1/channel/${channelId}.json`, 'GET')) - src/index.ts:197-197 (schema)The input schema for the tool: requires a single numeric 'channelId' parameter, validated with Zod.
{ channelId: z.number() }, - src/index.ts:194-199 (registration)Registration of the 'marketo_get_channel_by_id' tool on the MCP server with its description, schema, and handler.
server.tool( 'marketo_get_channel_by_id', 'Retrieve a single channel by its numeric ID. Returns the channel definition including progression statuses and their success mappings.', { channelId: z.number() }, tool(async ({ channelId }) => makeApiRequest(`/asset/v1/channel/${channelId}.json`, 'GET')) ); - src/index.ts:23-53 (helper)The makeApiRequest helper function that handles authentication token injection, HTTP request execution, and error handling for all API calls, used by the tool handler.
async function makeApiRequest( endpoint: string, method: string, data?: any, contentType: string = 'application/json' ) { const token = await tokenManager.getToken(); const headers: Record<string, string> = { Authorization: `Bearer ${token}`, }; if (contentType) { headers['Content-Type'] = contentType; } try { const response = await axios({ url: `${MARKETO_BASE_URL}${endpoint}`, method, data: contentType === 'application/x-www-form-urlencoded' ? new URLSearchParams(data).toString() : data, headers, }); return response.data; } catch (error: any) { console.error('API request failed:', error.response?.data || error.message); throw error; } }