marketo_update_channel
Update properties of a Marketo channel including name, description, and type. Note that progression statuses cannot be changed after creation.
Instructions
Update an existing channel's properties (name, description, type). Cannot change progression statuses after creation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | ||
| name | No | ||
| description | No | ||
| type | No | ||
| applicationId | No |
Implementation Reference
- src/index.ts:220-238 (registration)Registration of the 'marketo_update_channel' tool on the MCP server via server.tool() with name, description, and Zod schema.
server.tool( 'marketo_update_channel', 'Update an existing channel\'s properties (name, description, type). Cannot change progression statuses after creation.', { channelId: z.number(), name: z.string().optional(), description: z.string().optional(), type: z.string().optional(), applicationId: z.number().optional(), }, tool(async ({ channelId, name, description, type, applicationId }) => makeApiRequest(`/asset/v1/channel/${channelId}.json`, 'POST', { name, description, type, applicationId, }) ) ); - src/index.ts:230-237 (handler)Handler function that receives channelId, name, description, type, applicationId and calls makeApiRequest to POST to /asset/v1/channel/{channelId}.json, updating the channel properties.
tool(async ({ channelId, name, description, type, applicationId }) => makeApiRequest(`/asset/v1/channel/${channelId}.json`, 'POST', { name, description, type, applicationId, }) ) - src/index.ts:223-229 (schema)Zod schema defining the input parameters: channelId (required number), and optional name, description, type (strings), and applicationId (number).
{ channelId: z.number(), name: z.string().optional(), description: z.string().optional(), type: z.string().optional(), applicationId: z.number().optional(), }, - src/index.ts:23-53 (helper)The makeApiRequest helper function that handles authentication token retrieval and executes HTTP requests via axios.
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; } } - src/index.ts:55-74 (helper)The tool() wrapper helper that wraps handlers with try/catch and formats responses as MCP text content.
function tool<T>(handler: (args: T) => Promise<unknown>) { return async (args: T) => { try { const response = await handler(args); return { content: [{ type: 'text' as const, text: JSON.stringify(response, null, 2) }], }; } catch (error: any) { return { content: [ { type: 'text' as const, text: `Error: ${error.response?.data?.message || error.message}`, }, ], isError: true, }; } }; }