delete_template
Delete a Carbone template by ID. Soft delete marks it for garbage collection with a default 24-hour delay. Use Template ID to remove all versions, or Version ID to remove a specific version.
Instructions
Delete a stored Carbone template. This is a soft delete: the template is marked for garbage collection and removed after a delay (default 24 hours). You can delete by Template ID (removes all versions) or by Version ID (removes only that specific version). For immediate or scheduled deletion, use update_template_metadata with expireAt = 42000000000 (NOW) or a future Unix timestamp.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| templateId | Yes | Template ID (64-bit) or Version ID (SHA-256) to delete. Template ID — deletes the template record and all its versions. Version ID — deletes only that specific version, leaving other versions intact. Both formats are returned by upload_template and list_templates. |
Implementation Reference
- src/tools/templates.ts:310-326 (handler)The main handler function for the delete_template tool. It calls client.deleteTemplate(args.templateId, options) and returns success/error response.
export async function handleDeleteTemplate( args: { templateId: string }, client: CarboneClient, options?: CallOptions ) { try { await client.deleteTemplate(args.templateId, options); return { content: [{ type: 'text' as const, text: 'Template deleted successfully.' }], }; } catch (error) { return { isError: true, content: [{ type: 'text' as const, text: formatError(error) }], }; } } - src/tools/templates.ts:298-308 (schema)Input schema for delete_template — requires a templateId string (min 1 char) which can be a Template ID (64-bit) or Version ID (SHA-256).
export const deleteTemplateSchema = { templateId: z .string() .min(1) .describe( 'Template ID (64-bit) or Version ID (SHA-256) to delete. ' + 'Template ID — deletes the template record and all its versions. ' + 'Version ID — deletes only that specific version, leaving other versions intact. ' + 'Both formats are returned by upload_template and list_templates.' ), }; - src/validation/schemas.ts:96-98 (schema)Validation schema using Zod — validates templateId is a non-empty string.
export const DeleteTemplateSchema = z.object({ templateId: z.string().min(1, 'Template ID required'), }); - src/tools/index.ts:99-103 (registration)Registration of the delete_template tool on the MCP server with its name, description, inputSchema, and handler callback.
server.registerTool( deleteTemplateToolName, { description: deleteTemplateDescription, inputSchema: deleteTemplateSchema }, (args, extra) => handleDeleteTemplate(args, client, { apiKey: extra.authInfo?.token }) ); - src/carbone/client.ts:227-229 (helper)CarboneClient.deleteTemplate — makes the actual HTTP DELETE request to /template/{id} to perform the soft delete.
async deleteTemplate(templateId: string, options?: CallOptions): Promise<void> { await this.request(`/template/${templateId}`, { method: 'DELETE' }, options); }