delete_template
Delete a Carbone template by marking it for garbage collection. Use template ID to remove all versions or version ID to delete only 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:307-323 (handler)The main handler function for the delete_template tool. It calls client.deleteTemplate with the templateId and returns a 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:295-305 (schema)Input schema for delete_template, defining templateId as a required string with descriptions for Template ID vs Version ID usage.
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/tools/index.ts:99-103 (registration)Registration of the delete_template tool with the MCP server, binding the tool name, description, schema, and handler.
server.registerTool( deleteTemplateToolName, { description: deleteTemplateDescription, inputSchema: deleteTemplateSchema }, (args, extra) => handleDeleteTemplate(args, client, { apiKey: extra.authInfo?.token }) ); - src/carbone/client.ts:227-229 (helper)The CarboneClient.deleteTemplate method that performs the actual HTTP DELETE request to /template/{id}.
async deleteTemplate(templateId: string, options?: CallOptions): Promise<void> { await this.request(`/template/${templateId}`, { method: 'DELETE' }, options); } - src/validation/schemas.ts:96-98 (schema)Zod schema DeleteTemplateSchema used for validation, requiring a non-empty templateId string.
export const DeleteTemplateSchema = z.object({ templateId: z.string().min(1, 'Template ID required'), });