delete_collection
Permanently remove an Intercom Help Center collection and all its contents. Provide the collection ID to delete. Warning: action cannot be undone.
Instructions
Delete an Intercom Help Center collection. WARNING: This action cannot be undone. The collection and all its contents will be permanently removed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Collection ID to delete (required) |
Implementation Reference
- src/index.ts:863-883 (handler)Handler function for delete_collection tool. Extracts the 'id' from args, validates it, then calls callIntercomAPI with a DELETE request to /help_center/collections/{id}. Returns a success message with the result.
if (name === 'delete_collection') { const { id } = args as { id: string }; // 驗證必填欄位 if (!id) { throw new Error('Collection ID is required'); } const result = await callIntercomAPI(`/help_center/collections/${id}`, 'DELETE'); return { content: [{ type: 'text', text: JSON.stringify({ success: true, message: `Collection ${id} has been deleted successfully`, ...result }, null, 2) }] }; } - src/index.ts:459-471 (schema)Schema/registration entry for delete_collection in the tools list. Defines inputSchema requiring an 'id' string property.
{ name: 'delete_collection', description: 'Delete an Intercom Help Center collection. WARNING: This action cannot be undone. The collection and all its contents will be permanently removed.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Collection ID to delete (required)' } }, required: ['id'] } - src/index.ts:459-471 (registration)Tool is registered as part of the ListToolsRequestSchema handler in the tools array, with name 'delete_collection'.
{ name: 'delete_collection', description: 'Delete an Intercom Help Center collection. WARNING: This action cannot be undone. The collection and all its contents will be permanently removed.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Collection ID to delete (required)' } }, required: ['id'] } - src/index.ts:113-145 (helper)callIntercomAPI helper function that makes authenticated HTTP requests to the Intercom API. Used by the delete_collection handler to send the DELETE request.
async function callIntercomAPI( endpoint: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE' = 'GET', body?: any ): Promise<any> { const options: RequestInit = { method, headers: { 'Authorization': `Bearer ${INTERCOM_TOKEN}`, 'Accept': 'application/json', 'Content-Type': 'application/json', 'Intercom-Version': '2.14' } }; if (body && (method === 'POST' || method === 'PUT')) { options.body = JSON.stringify(body); } const response = await fetch(`${INTERCOM_API_BASE}${endpoint}`, options); if (!response.ok) { const error = await response.text(); throw new Error(`Intercom API error: ${response.status} - ${error}`); } // Handle 204 No Content response if (response.status === 204) { return { success: true }; } return response.json(); }