delete_template
Remove a custom WhatsApp Business message template by its ID to manage your template library and maintain relevant messaging content.
Instructions
Delete a custom template
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| templateId | Yes | Template ID to delete |
Implementation Reference
- src/index.ts:810-820 (handler)MCP tool handler function that invokes the template service to delete a template by ID and returns a success or failure message in the required MCP content format.private async handleDeleteTemplate(args: any) { const deleted = await templateService.deleteTemplate(args.templateId); return { content: [ { type: 'text', text: deleted ? 'Template deleted successfully' : 'Cannot delete default template or template not found' } ] }; }
- src/index.ts:264-274 (registration)Tool registration entry in the tools array provided to the MCP ListTools handler, including name, description, and input schema.{ name: 'delete_template', description: 'Delete a custom template', inputSchema: { type: 'object', properties: { templateId: { type: 'string', description: 'Template ID to delete' } }, required: ['templateId'] } },
- src/index.ts:267-272 (schema)Input schema definition for the delete_template tool, specifying the required templateId parameter.inputSchema: { type: 'object', properties: { templateId: { type: 'string', description: 'Template ID to delete' } }, required: ['templateId']
- TemplateService method that performs the actual deletion: checks if not default, removes from internal Map, saves to storage, returns boolean success.async deleteTemplate(id: string): Promise<boolean> { // Don't delete default templates if (DEFAULT_TEMPLATES.find(t => t.id === id)) { return false; } const deleted = this.templates.delete(id); if (deleted) { await this.saveCustomTemplates(); } return deleted; }