@contentful/mcp-tools 0.12.14 → 0.12.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -134,6 +134,10 @@ Each tool includes semantic annotations to help MCP clients understand tool beha
134
134
  | | `validate_release` | Validate a release, optionally against publish/unpublish |
135
135
  | | `get_release_action` | Check the status of a queued release action |
136
136
  | | `list_release_actions` | List release actions (max 10 per request) |
137
+ | | `schedule_publish_release` | Schedule a release to publish at a future datetime (or reschedule) |
138
+ | | `schedule_unpublish_release` | Schedule a release to unpublish at a future datetime (or reschedule) |
139
+ | | `cancel_scheduled_release` | Cancel a scheduled release action (two-phase confirm) |
140
+ | | `list_scheduled_actions` | List scheduled actions (max 10 per request) |
137
141
  | **AI Actions** | `create_ai_action` | Create custom AI-powered workflows |
138
142
  | | `invoke_ai_action` | Invoke AI action with variables (bulk support) |
139
143
  | | `get_ai_action_invocation` | Get AI action invocation details |
package/dist/index.d.ts CHANGED
@@ -8639,6 +8639,113 @@ declare class ContentfulMcpTools {
8639
8639
  action?: "publish" | "unpublish" | "validate" | undefined;
8640
8640
  }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
8641
8641
  };
8642
+ schedulePublishRelease: {
8643
+ title: string;
8644
+ description: string;
8645
+ inputParams: {
8646
+ spaceId: zod.ZodString;
8647
+ environmentId: zod.ZodString;
8648
+ } & {
8649
+ releaseId: zod.ZodString;
8650
+ datetime: zod.ZodString;
8651
+ timezone: zod.ZodOptional<zod.ZodEffects<zod.ZodString, string, string>>;
8652
+ scheduledActionId: zod.ZodOptional<zod.ZodString>;
8653
+ };
8654
+ annotations: {
8655
+ readOnlyHint: boolean;
8656
+ destructiveHint: boolean;
8657
+ idempotentHint: boolean;
8658
+ openWorldHint: boolean;
8659
+ };
8660
+ tool: (params: {
8661
+ spaceId: string;
8662
+ environmentId: string;
8663
+ releaseId: string;
8664
+ datetime: string;
8665
+ timezone?: string | undefined;
8666
+ scheduledActionId?: string | undefined;
8667
+ }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
8668
+ };
8669
+ scheduleUnpublishRelease: {
8670
+ title: string;
8671
+ description: string;
8672
+ inputParams: {
8673
+ spaceId: zod.ZodString;
8674
+ environmentId: zod.ZodString;
8675
+ } & {
8676
+ releaseId: zod.ZodString;
8677
+ datetime: zod.ZodString;
8678
+ timezone: zod.ZodOptional<zod.ZodEffects<zod.ZodString, string, string>>;
8679
+ scheduledActionId: zod.ZodOptional<zod.ZodString>;
8680
+ };
8681
+ annotations: {
8682
+ readOnlyHint: boolean;
8683
+ destructiveHint: boolean;
8684
+ idempotentHint: boolean;
8685
+ openWorldHint: boolean;
8686
+ };
8687
+ tool: (params: {
8688
+ spaceId: string;
8689
+ environmentId: string;
8690
+ releaseId: string;
8691
+ datetime: string;
8692
+ timezone?: string | undefined;
8693
+ scheduledActionId?: string | undefined;
8694
+ }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
8695
+ };
8696
+ cancelScheduledRelease: {
8697
+ title: string;
8698
+ description: string;
8699
+ inputParams: {
8700
+ spaceId: zod.ZodString;
8701
+ environmentId: zod.ZodString;
8702
+ } & {
8703
+ releaseId: zod.ZodString;
8704
+ scheduledActionId: zod.ZodString;
8705
+ confirm: zod.ZodOptional<zod.ZodBoolean>;
8706
+ confirmToken: zod.ZodOptional<zod.ZodString>;
8707
+ };
8708
+ annotations: {
8709
+ readOnlyHint: boolean;
8710
+ destructiveHint: boolean;
8711
+ idempotentHint: boolean;
8712
+ openWorldHint: boolean;
8713
+ };
8714
+ tool: (params: {
8715
+ spaceId: string;
8716
+ environmentId: string;
8717
+ releaseId: string;
8718
+ scheduledActionId: string;
8719
+ confirmToken?: string | undefined;
8720
+ confirm?: boolean | undefined;
8721
+ }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
8722
+ };
8723
+ listScheduledActions: {
8724
+ title: string;
8725
+ description: string;
8726
+ inputParams: {
8727
+ spaceId: zod.ZodString;
8728
+ environmentId: zod.ZodString;
8729
+ } & {
8730
+ releaseId: zod.ZodOptional<zod.ZodString>;
8731
+ statusIn: zod.ZodOptional<zod.ZodString>;
8732
+ statusNin: zod.ZodOptional<zod.ZodString>;
8733
+ limit: zod.ZodOptional<zod.ZodNumber>;
8734
+ };
8735
+ annotations: {
8736
+ readOnlyHint: boolean;
8737
+ destructiveHint: boolean;
8738
+ openWorldHint: boolean;
8739
+ };
8740
+ tool: (params: {
8741
+ spaceId: string;
8742
+ environmentId: string;
8743
+ releaseId?: string | undefined;
8744
+ limit?: number | undefined;
8745
+ statusIn?: string | undefined;
8746
+ statusNin?: string | undefined;
8747
+ }, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
8748
+ };
8642
8749
  };
8643
8750
  /**
8644
8751
  * Get tag tools
package/dist/index.js CHANGED
@@ -393,7 +393,8 @@ var RESOURCE_DISPLAY_NAME = {
393
393
  experienceTemplate: "experience template",
394
394
  dataAssembly: "data assembly",
395
395
  designToken: "design token",
396
- release: "release"
396
+ release: "release",
397
+ scheduledAction: "scheduled action"
397
398
  };
398
399
  function buildConfirmationPreview(resource, id, details, confirmToken) {
399
400
  const displayName = RESOURCE_DISPLAY_NAME[resource];
@@ -9192,6 +9193,276 @@ function listReleaseActionsTool(config) {
9192
9193
  return withErrorHandling(tool2, "Error listing release actions");
9193
9194
  }
9194
9195
 
9196
+ // src/tools/releases/scheduleReleasePublish.ts
9197
+ import { z as z139 } from "zod";
9198
+ var SchedulePublishReleaseToolParams = BaseToolSchema.extend({
9199
+ releaseId: z139.string().describe("The ID of the release to schedule for publish"),
9200
+ datetime: z139.string().datetime({ offset: true }).describe("The ISO 8601 datetime at which the release should publish"),
9201
+ timezone: z139.string().refine((timezone) => {
9202
+ try {
9203
+ Intl.DateTimeFormat("en-US", { timeZone: timezone }).format(0);
9204
+ return true;
9205
+ } catch {
9206
+ return false;
9207
+ }
9208
+ }, "Must be a valid IANA timezone identifier").optional().describe("A valid IANA timezone identifier (e.g. Asia/Kolkata)"),
9209
+ scheduledActionId: z139.string().optional().describe(
9210
+ "Provide to reschedule an existing scheduled action instead of creating a new one"
9211
+ )
9212
+ });
9213
+ function schedulePublishReleaseTool(config) {
9214
+ async function tool2(args) {
9215
+ assertEnvironmentNotProtected(
9216
+ args.environmentId,
9217
+ config.protectedEnvironments
9218
+ );
9219
+ const contentfulClient = createToolClient(config, args);
9220
+ if (args.scheduledActionId) {
9221
+ const existing = await contentfulClient.scheduledActions.get({
9222
+ spaceId: args.spaceId,
9223
+ environmentId: args.environmentId,
9224
+ scheduledActionId: args.scheduledActionId
9225
+ });
9226
+ if (existing.action !== "publish") {
9227
+ throw new Error(
9228
+ `Scheduled action '${args.scheduledActionId}' is a '${existing.action}' action, not 'publish'.`
9229
+ );
9230
+ }
9231
+ if (existing.entity.sys.id !== args.releaseId) {
9232
+ throw new Error(
9233
+ `Scheduled action '${args.scheduledActionId}' targets release '${existing.entity.sys.id}', not '${args.releaseId}'.`
9234
+ );
9235
+ }
9236
+ const scheduledAction2 = await contentfulClient.scheduledActions.update(
9237
+ {
9238
+ spaceId: args.spaceId,
9239
+ scheduledActionId: args.scheduledActionId,
9240
+ version: existing.sys.version
9241
+ },
9242
+ {
9243
+ action: "publish",
9244
+ entity: existing.entity,
9245
+ environment: existing.environment,
9246
+ scheduledFor: {
9247
+ datetime: args.datetime,
9248
+ timezone: args.timezone
9249
+ }
9250
+ }
9251
+ );
9252
+ return createSuccessResponse(
9253
+ "Scheduled release publish rescheduled successfully",
9254
+ { scheduledAction: scheduledAction2 }
9255
+ );
9256
+ }
9257
+ const scheduledAction = await contentfulClient.scheduledActions.create(
9258
+ { spaceId: args.spaceId },
9259
+ {
9260
+ entity: {
9261
+ sys: { type: "Link", linkType: "Release", id: args.releaseId }
9262
+ },
9263
+ environment: {
9264
+ sys: {
9265
+ type: "Link",
9266
+ linkType: "Environment",
9267
+ id: args.environmentId
9268
+ }
9269
+ },
9270
+ action: "publish",
9271
+ scheduledFor: {
9272
+ datetime: args.datetime,
9273
+ timezone: args.timezone
9274
+ }
9275
+ }
9276
+ );
9277
+ return createSuccessResponse("Release publish scheduled successfully", {
9278
+ scheduledAction
9279
+ });
9280
+ }
9281
+ return withErrorHandling(tool2, "Error scheduling release publish");
9282
+ }
9283
+
9284
+ // src/tools/releases/scheduleReleaseUnpublish.ts
9285
+ import { z as z140 } from "zod";
9286
+ var ScheduleUnpublishReleaseToolParams = BaseToolSchema.extend({
9287
+ releaseId: z140.string().describe("The ID of the release to schedule for unpublish"),
9288
+ datetime: z140.string().datetime({ offset: true }).describe("The ISO 8601 datetime at which the release should unpublish"),
9289
+ timezone: z140.string().refine((timezone) => {
9290
+ try {
9291
+ Intl.DateTimeFormat("en-US", { timeZone: timezone }).format(0);
9292
+ return true;
9293
+ } catch {
9294
+ return false;
9295
+ }
9296
+ }, "Must be a valid IANA timezone identifier").optional().describe("A valid IANA timezone identifier (e.g. Asia/Kolkata)"),
9297
+ scheduledActionId: z140.string().optional().describe(
9298
+ "Provide to reschedule an existing scheduled action instead of creating a new one"
9299
+ )
9300
+ });
9301
+ function scheduleUnpublishReleaseTool(config) {
9302
+ async function tool2(args) {
9303
+ assertEnvironmentNotProtected(
9304
+ args.environmentId,
9305
+ config.protectedEnvironments
9306
+ );
9307
+ const contentfulClient = createToolClient(config, args);
9308
+ if (args.scheduledActionId) {
9309
+ const existing = await contentfulClient.scheduledActions.get({
9310
+ spaceId: args.spaceId,
9311
+ environmentId: args.environmentId,
9312
+ scheduledActionId: args.scheduledActionId
9313
+ });
9314
+ if (existing.action !== "unpublish") {
9315
+ throw new Error(
9316
+ `Scheduled action '${args.scheduledActionId}' is a '${existing.action}' action, not 'unpublish'.`
9317
+ );
9318
+ }
9319
+ if (existing.entity.sys.id !== args.releaseId) {
9320
+ throw new Error(
9321
+ `Scheduled action '${args.scheduledActionId}' targets release '${existing.entity.sys.id}', not '${args.releaseId}'.`
9322
+ );
9323
+ }
9324
+ const scheduledAction2 = await contentfulClient.scheduledActions.update(
9325
+ {
9326
+ spaceId: args.spaceId,
9327
+ scheduledActionId: args.scheduledActionId,
9328
+ version: existing.sys.version
9329
+ },
9330
+ {
9331
+ action: "unpublish",
9332
+ entity: existing.entity,
9333
+ environment: existing.environment,
9334
+ scheduledFor: {
9335
+ datetime: args.datetime,
9336
+ timezone: args.timezone
9337
+ }
9338
+ }
9339
+ );
9340
+ return createSuccessResponse(
9341
+ "Scheduled release unpublish rescheduled successfully",
9342
+ { scheduledAction: scheduledAction2 }
9343
+ );
9344
+ }
9345
+ const scheduledAction = await contentfulClient.scheduledActions.create(
9346
+ { spaceId: args.spaceId },
9347
+ {
9348
+ entity: {
9349
+ sys: { type: "Link", linkType: "Release", id: args.releaseId }
9350
+ },
9351
+ environment: {
9352
+ sys: {
9353
+ type: "Link",
9354
+ linkType: "Environment",
9355
+ id: args.environmentId
9356
+ }
9357
+ },
9358
+ action: "unpublish",
9359
+ scheduledFor: {
9360
+ datetime: args.datetime,
9361
+ timezone: args.timezone
9362
+ }
9363
+ }
9364
+ );
9365
+ return createSuccessResponse("Release unpublish scheduled successfully", {
9366
+ scheduledAction
9367
+ });
9368
+ }
9369
+ return withErrorHandling(tool2, "Error scheduling release unpublish");
9370
+ }
9371
+
9372
+ // src/tools/releases/cancelScheduledRelease.ts
9373
+ import { z as z141 } from "zod";
9374
+ var CancelScheduledReleaseToolParams = BaseToolSchema.extend({
9375
+ releaseId: z141.string().describe("The ID of the release the scheduled action belongs to"),
9376
+ scheduledActionId: z141.string().describe("The ID of the scheduled action to cancel"),
9377
+ confirm: z141.boolean().optional().describe(
9378
+ "Set to true on the second call to actually cancel the scheduled action. Required together with confirmToken."
9379
+ ),
9380
+ confirmToken: z141.string().optional().describe(
9381
+ "Token returned by the preview call; must be supplied with confirm: true."
9382
+ )
9383
+ });
9384
+ function cancelScheduledReleaseTool(config) {
9385
+ async function tool2(args) {
9386
+ assertEnvironmentNotProtected(
9387
+ args.environmentId,
9388
+ config.protectedEnvironments
9389
+ );
9390
+ const contentfulClient = createToolClient(config, args);
9391
+ const scheduledAction = await contentfulClient.scheduledActions.get({
9392
+ spaceId: args.spaceId,
9393
+ environmentId: args.environmentId,
9394
+ scheduledActionId: args.scheduledActionId
9395
+ });
9396
+ if (scheduledAction.entity.sys.id !== args.releaseId) {
9397
+ throw new Error(
9398
+ `Scheduled action '${args.scheduledActionId}' targets release '${scheduledAction.entity.sys.id}', not '${args.releaseId}'.`
9399
+ );
9400
+ }
9401
+ const expectedToken = buildConfirmToken(
9402
+ "scheduledAction",
9403
+ args.scheduledActionId,
9404
+ scheduledAction.sys.version
9405
+ );
9406
+ if (args.confirm !== true || args.confirmToken !== expectedToken) {
9407
+ const preview = buildConfirmationPreview(
9408
+ "scheduledAction",
9409
+ args.scheduledActionId,
9410
+ { scheduledAction },
9411
+ expectedToken
9412
+ );
9413
+ return createSuccessResponse(
9414
+ `${CONFIRMATION_MESSAGE_PREFIX} scheduled action`,
9415
+ preview
9416
+ );
9417
+ }
9418
+ await contentfulClient.scheduledActions.delete({
9419
+ spaceId: args.spaceId,
9420
+ environmentId: args.environmentId,
9421
+ scheduledActionId: args.scheduledActionId
9422
+ });
9423
+ return createSuccessResponse(
9424
+ "Scheduled release action canceled successfully",
9425
+ { scheduledAction }
9426
+ );
9427
+ }
9428
+ return withErrorHandling(tool2, "Error canceling scheduled release action");
9429
+ }
9430
+
9431
+ // src/tools/releases/listScheduledActions.ts
9432
+ import { z as z142 } from "zod";
9433
+ var MAX_ITEMS3 = 10;
9434
+ var ListScheduledActionsToolParams = BaseToolSchema.extend({
9435
+ releaseId: z142.string().optional().describe("Filter by the release this scheduled action targets"),
9436
+ statusIn: z142.string().optional().describe(
9437
+ "Comma-separated list of statuses to include (scheduled, inProgress, succeeded, failed, canceled)"
9438
+ ),
9439
+ statusNin: z142.string().optional().describe("Comma-separated list of statuses to exclude"),
9440
+ limit: z142.number().optional().describe("Maximum number of scheduled actions to return (max 10)")
9441
+ });
9442
+ function listScheduledActionsTool(config) {
9443
+ async function tool2(args) {
9444
+ const contentfulClient = createToolClient(config, args);
9445
+ const scheduledActions = await contentfulClient.scheduledActions.getMany({
9446
+ spaceId: args.spaceId,
9447
+ query: {
9448
+ "environment.sys.id": args.environmentId,
9449
+ limit: Math.max(1, Math.min(args.limit ?? MAX_ITEMS3, MAX_ITEMS3)),
9450
+ ...args.releaseId && { "entity.sys.id": args.releaseId },
9451
+ ...args.statusIn && { "sys.status[in]": args.statusIn },
9452
+ ...args.statusNin && { "sys.status[nin]": args.statusNin }
9453
+ }
9454
+ });
9455
+ const summarized = summarizeData(scheduledActions, {
9456
+ maxItems: MAX_ITEMS3,
9457
+ remainingMessage: "To see more scheduled actions, narrow your filters or ask for a smaller limit."
9458
+ });
9459
+ return createSuccessResponse("Scheduled actions retrieved successfully", {
9460
+ scheduledActions: summarized
9461
+ });
9462
+ }
9463
+ return withErrorHandling(tool2, "Error listing scheduled actions");
9464
+ }
9465
+
9195
9466
  // src/tools/releases/register.ts
9196
9467
  function createReleaseTools(config) {
9197
9468
  const listReleases = listReleasesTool(config);
@@ -9204,6 +9475,10 @@ function createReleaseTools(config) {
9204
9475
  const validateRelease = validateReleaseTool(config);
9205
9476
  const getReleaseAction = getReleaseActionTool(config);
9206
9477
  const listReleaseActions = listReleaseActionsTool(config);
9478
+ const schedulePublishRelease = schedulePublishReleaseTool(config);
9479
+ const scheduleUnpublishRelease = scheduleUnpublishReleaseTool(config);
9480
+ const cancelScheduledRelease = cancelScheduledReleaseTool(config);
9481
+ const listScheduledActions = listScheduledActionsTool(config);
9207
9482
  return {
9208
9483
  listReleases: {
9209
9484
  title: "list_releases",
@@ -9320,6 +9595,53 @@ function createReleaseTools(config) {
9320
9595
  openWorldHint: false
9321
9596
  },
9322
9597
  tool: listReleaseActions
9598
+ },
9599
+ schedulePublishRelease: {
9600
+ title: "schedule_publish_release",
9601
+ description: "Schedule a release to publish at a future datetime, or reschedule an existing scheduled publish action by providing scheduledActionId.",
9602
+ inputParams: SchedulePublishReleaseToolParams.shape,
9603
+ annotations: {
9604
+ readOnlyHint: false,
9605
+ destructiveHint: true,
9606
+ idempotentHint: false,
9607
+ openWorldHint: false
9608
+ },
9609
+ tool: schedulePublishRelease
9610
+ },
9611
+ scheduleUnpublishRelease: {
9612
+ title: "schedule_unpublish_release",
9613
+ description: "Schedule a release to unpublish at a future datetime, or reschedule an existing scheduled unpublish action by providing scheduledActionId.",
9614
+ inputParams: ScheduleUnpublishReleaseToolParams.shape,
9615
+ annotations: {
9616
+ readOnlyHint: false,
9617
+ destructiveHint: true,
9618
+ idempotentHint: false,
9619
+ openWorldHint: false
9620
+ },
9621
+ tool: scheduleUnpublishRelease
9622
+ },
9623
+ cancelScheduledRelease: {
9624
+ title: "cancel_scheduled_release",
9625
+ description: "Cancel a scheduled release action. This is a two-phase operation: the first call (without confirm/confirmToken) returns a preview of the scheduled action and a confirmToken. To complete the cancellation, call this tool again with the same scheduledActionId, confirm: true, and the confirmToken from the preview response.",
9626
+ inputParams: CancelScheduledReleaseToolParams.shape,
9627
+ annotations: {
9628
+ readOnlyHint: false,
9629
+ destructiveHint: true,
9630
+ idempotentHint: false,
9631
+ openWorldHint: false
9632
+ },
9633
+ tool: cancelScheduledRelease
9634
+ },
9635
+ listScheduledActions: {
9636
+ title: "list_scheduled_actions",
9637
+ description: "List scheduled actions in a space/environment. Returns a maximum of 10 items per request. Optionally filter by release ID or status.",
9638
+ inputParams: ListScheduledActionsToolParams.shape,
9639
+ annotations: {
9640
+ readOnlyHint: true,
9641
+ destructiveHint: false,
9642
+ openWorldHint: false
9643
+ },
9644
+ tool: listScheduledActions
9323
9645
  }
9324
9646
  };
9325
9647
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/mcp-tools",
3
- "version": "0.12.14",
3
+ "version": "0.12.15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",