update_package_expiration_date_and_time
Set or change a package's expiration date and time, and toggle unlimited storage. Disabling unlimited storage requires an expiration date. Expired packages are permanently deleted.
Instructions
Update package expiration date and time. Also allows enable or disable unlimited storage. Additional package storage may incur charges, depending on your team subscription plan. Once expired the package and all of its files are deleted and can not be restored.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| packageId | Yes | Id of the package to update expiry date for | |
| unlimited_storage | Yes | Specifies if unlimited storage is enabled or disabled for a package. If disabling unlimited storage expiry parameter must be set | |
| expiry | No | The date and time on which the package will expire in UTC (ISO 8601 format). When setting expiry unlimited_storage parameter should be false |
Implementation Reference
- src/api/packages.ts:247-260 (schema)UpdatePackageExpiryDateSchema - Zod schema defining the input parameters for the tool: packageId (string), unlimited_storage (boolean), and optional expiry (ISO 8601 datetime).
const UpdatePackageExpiryDateSchema = z.object({ packageId: z.string().describe("Id of the package to update expiry date for"), unlimited_storage: z .boolean() .describe( "Specifies if unlimited storage is enabled or disabled for a package. If disabling unlimited storage expiry parameter must be set", ), expiry: z.iso .datetime() .describe( "The date and time on which the package will expire in UTC (ISO 8601 format). When setting expiry unlimited_storage parameter should be false", ) .optional(), }); - src/api/packages.ts:266-312 (handler)updatePackageExpiry - The main handler function that takes packageId, unlimited_storage, and optional expiry. It gets a package token, then PUTs to /v1/packages/{packageId}/expiry with the appropriate body (either unlimited_storage:true, or unlimited_storage:false with expiry set).
async function updatePackageExpiry({ packageId, unlimited_storage, expiry, }: UpdatePackageExpiryDateSchemaParams) { const packageToken = await getPackageToken(packageId); const url = new URL(`${MASV_BASE_URL}/v1/packages/${packageId}/expiry`); const headers = { "content-type": "application/json", "x-package-token": packageToken, }; let body; if (unlimited_storage == true) { if (expiry) { throw new Error( "Can not set both unlimited_storage: true and expiration date. If you want to enable unlimited storage please only pass unlimited_storage parameter", ); } body = { unlimited_storage: true, }; } else { if (!expiry) throw new Error( "expiry parameter must be provided if unlimited storage is disabled", ); body = { unlimited_storage: false, expiry, }; } const r = await fetch(url.toString(), { method: "PUT", headers, body: JSON.stringify(body), }); const data = await r.json(); return data; } - src/index.ts:156-172 (registration)server.registerTool('update_package_expiration_date_and_time', ...) - Registers the tool with the MCP server, linking the schema (UpdatePackageExpiryDateSchema.shape) to the handler callback that calls updatePackageExpiry and formats the response via mcpOk/mcpError.
server.registerTool( "update_package_expiration_date_and_time", { description: "Update package expiration date and time. Also allows enable or disable unlimited storage. Additional package storage may incur charges, depending on your team subscription plan. Once expired the package and all of its files are deleted and can not be restored.", inputSchema: UpdatePackageExpiryDateSchema.shape, }, async (args) => { try { const data = await updatePackageExpiry(args); return mcpOk(data); } catch (error) { return mcpError(error); } }, ); - src/index.ts:16-17 (registration)Import of UpdatePackageExpiryDateSchema and updatePackageExpiry from ./api/packages.js.
UpdatePackageExpiryDateSchema, updatePackageExpiry, - src/api/packages.ts:355-356 (registration)Export of UpdatePackageExpiryDateSchema and updatePackageExpiry from the packages module.
UpdatePackageExpiryDateSchema, updatePackageExpiry,