marketo_delete_channel
Delete a specific channel in Marketo by providing its channel ID to remove it from the system.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes |
Implementation Reference
- src/index.ts:364-378 (handler)The handler function that performs the actual deletion by sending a POST request to the Marketo API endpoint for deleting a channel.async ({ channelId }) => { try { const response = await makeApiRequest(`/asset/v1/channel/${channelId}/delete.json`, 'POST'); return { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error: ${error.response?.data?.message || error.message}` }, ], }; } }
- src/index.ts:361-363 (schema)Zod schema for input validation, requiring a channelId as a number.{ channelId: z.number(), },
- src/index.ts:360-379 (registration)Registers the 'marketo_delete_channel' tool with the MCP server, including schema and handler.'marketo_delete_channel', { channelId: z.number(), }, async ({ channelId }) => { try { const response = await makeApiRequest(`/asset/v1/channel/${channelId}/delete.json`, 'POST'); return { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error: ${error.response?.data?.message || error.message}` }, ], }; } } );
- src/index.ts:22-52 (helper)Shared utility function used by the tool to make authenticated HTTP requests to the Marketo API.async function makeApiRequest( endpoint: string, method: string, data?: any, contentType: string = 'application/json' ) { const token = await tokenManager.getToken(); const headers: any = { Authorization: `Bearer ${token}`, }; if (contentType) { headers['Content-Type'] = contentType; } try { const response = await axios({ url: `${MARKETO_BASE_URL}${endpoint}`, method: 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; } }