update_template_metadata
Update template metadata including name, comment, category, tags, deployment time, or expiration. Use deployedAt to activate a version 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:258-283 (handler)The handler function for update_template_metadata. It accepts templateId, name, comment, category, tags, deployedAt, and expireAt, and delegates to client.updateTemplate(). Returns success or error content.
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:226-256 (schema)The input schema definition for update_template_metadata using Zod. Defines templateId (required string) and optional fields: name, comment, category, tags, deployedAt, expireAt.
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 update_template_metadata with the MCP server via server.registerTool(), binding the name, description, inputSchema, and handler.
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 method that sends a PATCH request to /template/{id} with optional metadata fields. This is the actual API call invoked by the handler.
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/validation/schemas.ts:85-94 (schema)Validation schema UpdateTemplateSchema defined with Zod, providing an alternative schema definition for update template metadata.
export const UpdateTemplateSchema = z.object({ templateId: z.string().min(1, 'Template ID required'), name: z.string().optional(), comment: z.string().optional(), category: z.string().optional(), tags: z.array(z.string()).optional(), // Unix timestamps (seconds). Pass 42000000000 to mean "deploy/expire NOW". deployedAt: z.number().int().optional(), expireAt: z.number().int().optional(), });