update_template_metadata
Update template metadata including name, category, tags, deployment, or expiration. Set deployedAt to activate a version for rendering or expireAt to schedule deletion.
Instructions
Update the metadata of a stored template: name, comment, category, tags, deployment timestamp, or expiration. Use deployedAt to activate a specific version for rendering. Use expireAt to schedule or trigger immediate deletion.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| templateId | Yes | Template ID (64-bit) or Version ID (SHA-256) to update. Using a Template ID updates the metadata shared by all versions. Using a Version ID updates only that specific version. | |
| name | No | New display name. | |
| comment | No | New free-text comment. | |
| category | No | New category. | |
| tags | No | New list of tags — replaces existing tags entirely. | |
| deployedAt | No | Unix timestamp (seconds) to set as the deployment time for this version. Carbone picks the version with the most recent deployedAt when rendering. Use 42000000000 to deploy immediately (special "NOW" value). | |
| expireAt | No | Unix timestamp (seconds) at which this template will be automatically deleted. Use 42000000000 to delete immediately. |
Implementation Reference
- src/tools/templates.ts:261-286 (handler)Main handler for update_template_metadata. Calls client.updateTemplate(args, options) and returns success or error message.
export async function handleUpdateTemplateMetadata( args: { templateId: string; name?: string; comment?: string; category?: string; tags?: string[]; deployedAt?: number; expireAt?: number; }, client: CarboneClient, options?: CallOptions ) { try { await client.updateTemplate(args, options); return { content: [{ type: 'text' as const, text: 'Template metadata updated successfully.' }], }; } catch (error) { return { isError: true, content: [{ type: 'text' as const, text: formatError(error) }], }; } } - src/tools/templates.ts:229-259 (schema)Input schema definition using Zod for update_template_metadata. Validates templateId, name, comment, category, tags, deployedAt, and expireAt fields.
export const updateTemplateMetadataSchema = { templateId: z .string() .min(1) .describe( 'Template ID (64-bit) or Version ID (SHA-256) to update. ' + 'Using a Template ID updates the metadata shared by all versions. ' + 'Using a Version ID updates only that specific version.' ), name: z.string().optional().describe('New display name.'), comment: z.string().optional().describe('New free-text comment.'), category: z.string().optional().describe('New category.'), tags: z.array(z.string()).optional().describe('New list of tags — replaces existing tags entirely.'), deployedAt: z .number() .int() .optional() .describe( 'Unix timestamp (seconds) to set as the deployment time for this version. ' + 'Carbone picks the version with the most recent deployedAt when rendering. ' + 'Use 42000000000 to deploy immediately (special "NOW" value).' ), expireAt: z .number() .int() .optional() .describe( 'Unix timestamp (seconds) at which this template will be automatically deleted. ' + 'Use 42000000000 to delete immediately.' ), }; - src/tools/index.ts:93-97 (registration)Registration of the update_template_metadata tool with the MCP server, including name, description, input schema, and handler binding.
server.registerTool( updateTemplateMetadataToolName, { description: updateTemplateMetadataDescription, inputSchema: updateTemplateMetadataSchema }, (args, extra) => handleUpdateTemplateMetadata(args, client, { apiKey: extra.authInfo?.token }) ); - src/carbone/client.ts:199-221 (helper)CarboneClient.updateTemplate() — makes a PATCH /template/{id} API call with the metadata fields to update the template.
async updateTemplate(params: { templateId: string; name?: string; comment?: string; category?: string; tags?: string[]; deployedAt?: number; expireAt?: number; }, options?: CallOptions): Promise<void> { const body: Record<string, unknown> = {}; if (params.name !== undefined) body['name'] = params.name; if (params.comment !== undefined) body['comment'] = params.comment; if (params.category !== undefined) body['category'] = params.category; if (params.tags !== undefined) body['tags'] = params.tags; if (params.deployedAt !== undefined) body['deployedAt'] = params.deployedAt; if (params.expireAt !== undefined) body['expireAt'] = params.expireAt; await this.request(`/template/${params.templateId}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), }, options); } - src/tools/index.ts:33-96 (registration)Imports of updateTemplateMetadataToolName, description, schema, and handler from templates.ts into the registration module.
updateTemplateMetadataToolName, updateTemplateMetadataDescription, updateTemplateMetadataSchema, handleUpdateTemplateMetadata, deleteTemplateToolName, deleteTemplateDescription, deleteTemplateSchema, handleDeleteTemplate, downloadTemplateToolName, downloadTemplateDescription, downloadTemplateSchema, handleDownloadTemplate, } from './templates.js'; import { getApiStatusToolName, getApiStatusDescription, handleGetApiStatus, getCapabilitiesToolName, getCapabilitiesDescription, handleGetCapabilities, } from './info.js'; export function registerTools(server: McpServer, client: CarboneClient): void { server.registerTool( listTemplatesToolName, { description: listTemplatesDescription, inputSchema: listTemplatesSchema }, (args, extra) => handleListTemplates(args, client, { apiKey: extra.authInfo?.token }) ); server.registerTool( convertDocumentToolName, { description: convertDocumentDescription, inputSchema: convertDocumentSchema }, (args, extra) => handleConvertDocument(args, client, { apiKey: extra.authInfo?.token }) ); server.registerTool( renderDocumentToolName, { description: renderDocumentDescription, inputSchema: renderDocumentSchema }, (args, extra) => handleRenderDocument(args, client, { apiKey: extra.authInfo?.token }) ); server.registerTool( listCategoriesToolName, { description: listCategoriesDescription }, (extra) => handleListCategories({} as never, client, { apiKey: extra.authInfo?.token }) ); server.registerTool( listTagsToolName, { description: listTagsDescription }, (extra) => handleListTags({} as never, client, { apiKey: extra.authInfo?.token }) ); server.registerTool( uploadTemplateToolName, { description: uploadTemplateDescription, inputSchema: uploadTemplateSchema }, (args, extra) => handleUploadTemplate(args, client, { apiKey: extra.authInfo?.token }) ); server.registerTool( updateTemplateMetadataToolName, { description: updateTemplateMetadataDescription, inputSchema: updateTemplateMetadataSchema }, (args, extra) => handleUpdateTemplateMetadata(args, client, { apiKey: extra.authInfo?.token })