@contentful/mcp-tools 0.12.8 → 0.12.9
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/dist/index.d.ts +207 -0
- package/dist/index.js +257 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4233,6 +4233,7 @@ declare class ContentfulMcpTools {
|
|
|
4233
4233
|
spaceId: zod.ZodString;
|
|
4234
4234
|
environmentId: zod.ZodString;
|
|
4235
4235
|
} & {
|
|
4236
|
+
componentId: zod.ZodOptional<zod.ZodString>;
|
|
4236
4237
|
name: zod.ZodString;
|
|
4237
4238
|
description: zod.ZodString;
|
|
4238
4239
|
viewports: zod.ZodArray<zod.ZodObject<{
|
|
@@ -4655,6 +4656,7 @@ declare class ContentfulMcpTools {
|
|
|
4655
4656
|
};
|
|
4656
4657
|
}[] | undefined;
|
|
4657
4658
|
} | undefined;
|
|
4659
|
+
componentId?: string | undefined;
|
|
4658
4660
|
slots?: {
|
|
4659
4661
|
name: string;
|
|
4660
4662
|
required: boolean;
|
|
@@ -10310,6 +10312,211 @@ declare class ContentfulMcpTools {
|
|
|
10310
10312
|
}, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
|
|
10311
10313
|
};
|
|
10312
10314
|
};
|
|
10315
|
+
/**
|
|
10316
|
+
* Get ExO design token tools
|
|
10317
|
+
*/
|
|
10318
|
+
getDesignTokenTools(): {
|
|
10319
|
+
getDesignToken: {
|
|
10320
|
+
title: string;
|
|
10321
|
+
description: string;
|
|
10322
|
+
inputParams: {
|
|
10323
|
+
spaceId: zod.ZodString;
|
|
10324
|
+
environmentId: zod.ZodString;
|
|
10325
|
+
} & {
|
|
10326
|
+
designTokenId: zod.ZodString;
|
|
10327
|
+
};
|
|
10328
|
+
annotations: {
|
|
10329
|
+
readOnlyHint: boolean;
|
|
10330
|
+
destructiveHint: boolean;
|
|
10331
|
+
openWorldHint: boolean;
|
|
10332
|
+
};
|
|
10333
|
+
tool: (params: {
|
|
10334
|
+
spaceId: string;
|
|
10335
|
+
environmentId: string;
|
|
10336
|
+
designTokenId: string;
|
|
10337
|
+
}, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
|
|
10338
|
+
};
|
|
10339
|
+
listDesignTokens: {
|
|
10340
|
+
title: string;
|
|
10341
|
+
description: string;
|
|
10342
|
+
inputParams: {
|
|
10343
|
+
spaceId: zod.ZodString;
|
|
10344
|
+
environmentId: zod.ZodString;
|
|
10345
|
+
} & {
|
|
10346
|
+
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
10347
|
+
pageNext: zod.ZodOptional<zod.ZodString>;
|
|
10348
|
+
pagePrev: zod.ZodOptional<zod.ZodString>;
|
|
10349
|
+
type: zod.ZodOptional<zod.ZodEnum<["DTCG.Color", "DTCG.Dimension", "DTCG.FontFamily", "DTCG.FontWeight", "DTCG.Duration", "DTCG.CubicBezier", "DTCG.Number", "DTCG.StrokeStyle", "DTCG.Border", "DTCG.Transition", "DTCG.Shadow", "DTCG.Gradient", "DTCG.Typography"]>>;
|
|
10350
|
+
};
|
|
10351
|
+
annotations: {
|
|
10352
|
+
readOnlyHint: boolean;
|
|
10353
|
+
destructiveHint: boolean;
|
|
10354
|
+
openWorldHint: boolean;
|
|
10355
|
+
};
|
|
10356
|
+
tool: (params: {
|
|
10357
|
+
spaceId: string;
|
|
10358
|
+
environmentId: string;
|
|
10359
|
+
type?: "DTCG.Color" | "DTCG.Dimension" | "DTCG.FontFamily" | "DTCG.FontWeight" | "DTCG.Duration" | "DTCG.CubicBezier" | "DTCG.Number" | "DTCG.StrokeStyle" | "DTCG.Border" | "DTCG.Transition" | "DTCG.Shadow" | "DTCG.Gradient" | "DTCG.Typography" | undefined;
|
|
10360
|
+
limit?: number | undefined;
|
|
10361
|
+
pageNext?: string | undefined;
|
|
10362
|
+
pagePrev?: string | undefined;
|
|
10363
|
+
}, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
|
|
10364
|
+
};
|
|
10365
|
+
upsertDesignToken: {
|
|
10366
|
+
title: string;
|
|
10367
|
+
description: string;
|
|
10368
|
+
inputParams: {
|
|
10369
|
+
spaceId: zod.ZodString;
|
|
10370
|
+
environmentId: zod.ZodString;
|
|
10371
|
+
} & {
|
|
10372
|
+
designTokenId: zod.ZodString;
|
|
10373
|
+
version: zod.ZodOptional<zod.ZodNumber>;
|
|
10374
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
10375
|
+
type: zod.ZodOptional<zod.ZodEnum<["DTCG.Color", "DTCG.Dimension", "DTCG.FontFamily", "DTCG.FontWeight", "DTCG.Duration", "DTCG.CubicBezier", "DTCG.Number", "DTCG.StrokeStyle", "DTCG.Border", "DTCG.Transition", "DTCG.Shadow", "DTCG.Gradient", "DTCG.Typography"]>>;
|
|
10376
|
+
metadata: zod.ZodOptional<zod.ZodObject<{
|
|
10377
|
+
tags: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
10378
|
+
sys: zod.ZodObject<{
|
|
10379
|
+
type: zod.ZodLiteral<"Link">;
|
|
10380
|
+
linkType: zod.ZodLiteral<"Tag">;
|
|
10381
|
+
id: zod.ZodString;
|
|
10382
|
+
}, "strip", zod.ZodTypeAny, {
|
|
10383
|
+
type: "Link";
|
|
10384
|
+
id: string;
|
|
10385
|
+
linkType: "Tag";
|
|
10386
|
+
}, {
|
|
10387
|
+
type: "Link";
|
|
10388
|
+
id: string;
|
|
10389
|
+
linkType: "Tag";
|
|
10390
|
+
}>;
|
|
10391
|
+
}, "strip", zod.ZodTypeAny, {
|
|
10392
|
+
sys: {
|
|
10393
|
+
type: "Link";
|
|
10394
|
+
id: string;
|
|
10395
|
+
linkType: "Tag";
|
|
10396
|
+
};
|
|
10397
|
+
}, {
|
|
10398
|
+
sys: {
|
|
10399
|
+
type: "Link";
|
|
10400
|
+
id: string;
|
|
10401
|
+
linkType: "Tag";
|
|
10402
|
+
};
|
|
10403
|
+
}>, "many">>;
|
|
10404
|
+
concepts: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
10405
|
+
sys: zod.ZodObject<{
|
|
10406
|
+
type: zod.ZodLiteral<"Link">;
|
|
10407
|
+
linkType: zod.ZodLiteral<"TaxonomyConcept">;
|
|
10408
|
+
id: zod.ZodString;
|
|
10409
|
+
}, "strip", zod.ZodTypeAny, {
|
|
10410
|
+
type: "Link";
|
|
10411
|
+
id: string;
|
|
10412
|
+
linkType: "TaxonomyConcept";
|
|
10413
|
+
}, {
|
|
10414
|
+
type: "Link";
|
|
10415
|
+
id: string;
|
|
10416
|
+
linkType: "TaxonomyConcept";
|
|
10417
|
+
}>;
|
|
10418
|
+
}, "strip", zod.ZodTypeAny, {
|
|
10419
|
+
sys: {
|
|
10420
|
+
type: "Link";
|
|
10421
|
+
id: string;
|
|
10422
|
+
linkType: "TaxonomyConcept";
|
|
10423
|
+
};
|
|
10424
|
+
}, {
|
|
10425
|
+
sys: {
|
|
10426
|
+
type: "Link";
|
|
10427
|
+
id: string;
|
|
10428
|
+
linkType: "TaxonomyConcept";
|
|
10429
|
+
};
|
|
10430
|
+
}>, "many">>;
|
|
10431
|
+
}, "strip", zod.ZodTypeAny, {
|
|
10432
|
+
tags?: {
|
|
10433
|
+
sys: {
|
|
10434
|
+
type: "Link";
|
|
10435
|
+
id: string;
|
|
10436
|
+
linkType: "Tag";
|
|
10437
|
+
};
|
|
10438
|
+
}[] | undefined;
|
|
10439
|
+
concepts?: {
|
|
10440
|
+
sys: {
|
|
10441
|
+
type: "Link";
|
|
10442
|
+
id: string;
|
|
10443
|
+
linkType: "TaxonomyConcept";
|
|
10444
|
+
};
|
|
10445
|
+
}[] | undefined;
|
|
10446
|
+
}, {
|
|
10447
|
+
tags?: {
|
|
10448
|
+
sys: {
|
|
10449
|
+
type: "Link";
|
|
10450
|
+
id: string;
|
|
10451
|
+
linkType: "Tag";
|
|
10452
|
+
};
|
|
10453
|
+
}[] | undefined;
|
|
10454
|
+
concepts?: {
|
|
10455
|
+
sys: {
|
|
10456
|
+
type: "Link";
|
|
10457
|
+
id: string;
|
|
10458
|
+
linkType: "TaxonomyConcept";
|
|
10459
|
+
};
|
|
10460
|
+
}[] | undefined;
|
|
10461
|
+
}>>;
|
|
10462
|
+
};
|
|
10463
|
+
annotations: {
|
|
10464
|
+
readOnlyHint: boolean;
|
|
10465
|
+
destructiveHint: boolean;
|
|
10466
|
+
idempotentHint: boolean;
|
|
10467
|
+
openWorldHint: boolean;
|
|
10468
|
+
};
|
|
10469
|
+
tool: (params: {
|
|
10470
|
+
spaceId: string;
|
|
10471
|
+
environmentId: string;
|
|
10472
|
+
designTokenId: string;
|
|
10473
|
+
name?: string | undefined;
|
|
10474
|
+
version?: number | undefined;
|
|
10475
|
+
metadata?: {
|
|
10476
|
+
tags?: {
|
|
10477
|
+
sys: {
|
|
10478
|
+
type: "Link";
|
|
10479
|
+
id: string;
|
|
10480
|
+
linkType: "Tag";
|
|
10481
|
+
};
|
|
10482
|
+
}[] | undefined;
|
|
10483
|
+
concepts?: {
|
|
10484
|
+
sys: {
|
|
10485
|
+
type: "Link";
|
|
10486
|
+
id: string;
|
|
10487
|
+
linkType: "TaxonomyConcept";
|
|
10488
|
+
};
|
|
10489
|
+
}[] | undefined;
|
|
10490
|
+
} | undefined;
|
|
10491
|
+
type?: "DTCG.Color" | "DTCG.Dimension" | "DTCG.FontFamily" | "DTCG.FontWeight" | "DTCG.Duration" | "DTCG.CubicBezier" | "DTCG.Number" | "DTCG.StrokeStyle" | "DTCG.Border" | "DTCG.Transition" | "DTCG.Shadow" | "DTCG.Gradient" | "DTCG.Typography" | undefined;
|
|
10492
|
+
}, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
|
|
10493
|
+
};
|
|
10494
|
+
deleteDesignToken: {
|
|
10495
|
+
title: string;
|
|
10496
|
+
description: string;
|
|
10497
|
+
inputParams: {
|
|
10498
|
+
spaceId: zod.ZodString;
|
|
10499
|
+
environmentId: zod.ZodString;
|
|
10500
|
+
} & {
|
|
10501
|
+
designTokenId: zod.ZodString;
|
|
10502
|
+
confirm: zod.ZodOptional<zod.ZodBoolean>;
|
|
10503
|
+
confirmToken: zod.ZodOptional<zod.ZodString>;
|
|
10504
|
+
};
|
|
10505
|
+
annotations: {
|
|
10506
|
+
readOnlyHint: boolean;
|
|
10507
|
+
destructiveHint: boolean;
|
|
10508
|
+
idempotentHint: boolean;
|
|
10509
|
+
openWorldHint: boolean;
|
|
10510
|
+
};
|
|
10511
|
+
tool: (params: {
|
|
10512
|
+
spaceId: string;
|
|
10513
|
+
environmentId: string;
|
|
10514
|
+
designTokenId: string;
|
|
10515
|
+
confirmToken?: string | undefined;
|
|
10516
|
+
confirm?: boolean | undefined;
|
|
10517
|
+
}, extra?: _modelcontextprotocol_sdk_shared_protocol_js.RequestHandlerExtra<_modelcontextprotocol_sdk_types_js.ServerRequest, _modelcontextprotocol_sdk_types_js.ServerNotification>) => Promise<ToolResponse>;
|
|
10518
|
+
};
|
|
10519
|
+
};
|
|
10313
10520
|
/**
|
|
10314
10521
|
* Get job tools (space-to-space migration)
|
|
10315
10522
|
*/
|
package/dist/index.js
CHANGED
|
@@ -391,7 +391,8 @@ var RESOURCE_DISPLAY_NAME = {
|
|
|
391
391
|
experience: "experience",
|
|
392
392
|
experienceFragment: "experience fragment",
|
|
393
393
|
experienceTemplate: "experience template",
|
|
394
|
-
dataAssembly: "data assembly"
|
|
394
|
+
dataAssembly: "data assembly",
|
|
395
|
+
designToken: "design token"
|
|
395
396
|
};
|
|
396
397
|
function buildConfirmationPreview(resource, id, details, confirmToken) {
|
|
397
398
|
const displayName = RESOURCE_DISPLAY_NAME[resource];
|
|
@@ -6551,6 +6552,9 @@ var ExperienceSlotNodeSchema = z88.lazy(
|
|
|
6551
6552
|
|
|
6552
6553
|
// src/tools/exo/components/createComponent.ts
|
|
6553
6554
|
var CreateComponentToolParams = BaseToolSchema.extend({
|
|
6555
|
+
componentId: z89.string().optional().describe(
|
|
6556
|
+
"Optional ID for the component. If provided, will use upsert (create via PUT) with this ID"
|
|
6557
|
+
),
|
|
6554
6558
|
name: z89.string().describe("The name of the component"),
|
|
6555
6559
|
description: z89.string().describe("Description of the component"),
|
|
6556
6560
|
viewports: z89.array(ViewportSchema).describe("Viewport definitions for the component (may be empty)"),
|
|
@@ -6569,18 +6573,29 @@ function createComponentTool(config) {
|
|
|
6569
6573
|
config.protectedEnvironments
|
|
6570
6574
|
);
|
|
6571
6575
|
const contentfulClient = createExoToolClient(config, args);
|
|
6572
|
-
const
|
|
6573
|
-
|
|
6576
|
+
const componentData = {
|
|
6577
|
+
name: args.name,
|
|
6578
|
+
description: args.description,
|
|
6579
|
+
viewports: args.viewports,
|
|
6580
|
+
contentProperties: args.contentProperties,
|
|
6581
|
+
designProperties: args.designProperties,
|
|
6582
|
+
...args.componentTree && { componentTree: args.componentTree },
|
|
6583
|
+
...args.slots && { slots: args.slots },
|
|
6584
|
+
...args.metadata && { metadata: args.metadata }
|
|
6585
|
+
};
|
|
6586
|
+
const component = args.componentId ? await contentfulClient.component.upsert(
|
|
6574
6587
|
{
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
...
|
|
6582
|
-
...args.metadata && { metadata: args.metadata }
|
|
6588
|
+
spaceId: args.spaceId,
|
|
6589
|
+
environmentId: args.environmentId,
|
|
6590
|
+
componentId: args.componentId
|
|
6591
|
+
},
|
|
6592
|
+
{
|
|
6593
|
+
sys: { id: args.componentId, type: "Component" },
|
|
6594
|
+
...componentData
|
|
6583
6595
|
}
|
|
6596
|
+
) : await contentfulClient.component.create(
|
|
6597
|
+
{ spaceId: args.spaceId, environmentId: args.environmentId },
|
|
6598
|
+
componentData
|
|
6584
6599
|
);
|
|
6585
6600
|
return createSuccessResponse("Component created successfully", {
|
|
6586
6601
|
component
|
|
@@ -8581,6 +8596,231 @@ function createDataAssemblyTools(config) {
|
|
|
8581
8596
|
};
|
|
8582
8597
|
}
|
|
8583
8598
|
|
|
8599
|
+
// src/tools/exo/design-tokens/getDesignToken.ts
|
|
8600
|
+
import { z as z125 } from "zod";
|
|
8601
|
+
var GetDesignTokenToolParams = BaseToolSchema.extend({
|
|
8602
|
+
designTokenId: z125.string().describe("The ID of the design token to retrieve details for")
|
|
8603
|
+
});
|
|
8604
|
+
function getDesignTokenTool(config) {
|
|
8605
|
+
async function tool2(args) {
|
|
8606
|
+
const contentfulClient = createExoToolClient(config, args);
|
|
8607
|
+
const designToken = await contentfulClient.designToken.get({
|
|
8608
|
+
spaceId: args.spaceId,
|
|
8609
|
+
environmentId: args.environmentId,
|
|
8610
|
+
designTokenId: args.designTokenId
|
|
8611
|
+
});
|
|
8612
|
+
return createSuccessResponse("Design token retrieved successfully", {
|
|
8613
|
+
designToken
|
|
8614
|
+
});
|
|
8615
|
+
}
|
|
8616
|
+
return withErrorHandling(tool2, "Error retrieving design token");
|
|
8617
|
+
}
|
|
8618
|
+
|
|
8619
|
+
// src/tools/exo/design-tokens/listDesignTokens.ts
|
|
8620
|
+
import { z as z126 } from "zod";
|
|
8621
|
+
var ListDesignTokensToolParams = BaseToolSchema.extend({
|
|
8622
|
+
limit: z126.number().optional().describe("Maximum number of design tokens to return (max 10)"),
|
|
8623
|
+
pageNext: z126.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
8624
|
+
pagePrev: z126.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
8625
|
+
type: z126.enum(DTCG_DESIGN_PROPERTY_TYPES).optional().describe("Filter to design tokens of this DTCG type (e.g. DTCG.Color)")
|
|
8626
|
+
});
|
|
8627
|
+
function listDesignTokensTool(config) {
|
|
8628
|
+
async function tool2(args) {
|
|
8629
|
+
const contentfulClient = createExoToolClient(config, args);
|
|
8630
|
+
const cursorParam = args.pageNext ? { pageNext: args.pageNext } : args.pagePrev ? { pagePrev: args.pagePrev } : {};
|
|
8631
|
+
const designTokens = await contentfulClient.designToken.getMany({
|
|
8632
|
+
spaceId: args.spaceId,
|
|
8633
|
+
environmentId: args.environmentId,
|
|
8634
|
+
query: {
|
|
8635
|
+
limit: Math.min(args.limit || 10, 10),
|
|
8636
|
+
...args.type && { type: args.type },
|
|
8637
|
+
...cursorParam
|
|
8638
|
+
}
|
|
8639
|
+
});
|
|
8640
|
+
const summarized = summarizeData(designTokens, {
|
|
8641
|
+
maxItems: 10,
|
|
8642
|
+
remainingMessage: "To see more design tokens, ask me to retrieve the next page using the pageNext cursor."
|
|
8643
|
+
});
|
|
8644
|
+
return createSuccessResponse("Design tokens retrieved successfully", {
|
|
8645
|
+
designTokens: summarized,
|
|
8646
|
+
total: designTokens.total,
|
|
8647
|
+
limit: designTokens.limit,
|
|
8648
|
+
pages: designTokens.pages
|
|
8649
|
+
});
|
|
8650
|
+
}
|
|
8651
|
+
return withErrorHandling(tool2, "Error listing design tokens");
|
|
8652
|
+
}
|
|
8653
|
+
|
|
8654
|
+
// src/tools/exo/design-tokens/upsertDesignToken.ts
|
|
8655
|
+
import { z as z127 } from "zod";
|
|
8656
|
+
var UpsertDesignTokenToolParams = BaseToolSchema.extend({
|
|
8657
|
+
designTokenId: z127.string().describe("The ID of the design token to create or update"),
|
|
8658
|
+
version: z127.number().optional().describe(
|
|
8659
|
+
"The design token's sys.version, required when updating an existing token. You must call get_design_token first to read the current state and version. The update is rejected if this does not match the current version, which means the token changed since you read it. Omit this entirely to create a new design token with this designTokenId \u2014 in that case name and type are required. Design tokens have no separate publish step: every upsert auto-publishes server-side, which bumps sys.version by 2 (not 1) per call."
|
|
8660
|
+
),
|
|
8661
|
+
name: z127.string().optional().describe("The name of the design token; required when creating"),
|
|
8662
|
+
type: z127.enum(DTCG_DESIGN_PROPERTY_TYPES).optional().describe("The DTCG type of the design token; required when creating"),
|
|
8663
|
+
metadata: ExoMetadataSchema.optional().describe(
|
|
8664
|
+
"ExO metadata (tags, concepts); replaces existing if provided"
|
|
8665
|
+
)
|
|
8666
|
+
});
|
|
8667
|
+
function upsertDesignTokenTool(config) {
|
|
8668
|
+
async function tool2(args) {
|
|
8669
|
+
assertEnvironmentNotProtected(
|
|
8670
|
+
args.environmentId,
|
|
8671
|
+
config.protectedEnvironments
|
|
8672
|
+
);
|
|
8673
|
+
const params = {
|
|
8674
|
+
spaceId: args.spaceId,
|
|
8675
|
+
environmentId: args.environmentId,
|
|
8676
|
+
designTokenId: args.designTokenId
|
|
8677
|
+
};
|
|
8678
|
+
const contentfulClient = createExoToolClient(config, args);
|
|
8679
|
+
if (args.version !== void 0) {
|
|
8680
|
+
const current = await contentfulClient.designToken.get(params);
|
|
8681
|
+
if (args.version !== current.sys.version) {
|
|
8682
|
+
throw new Error(
|
|
8683
|
+
`Version conflict: the design token has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the design token with get_design_token and retry the update with the latest sys.version.`
|
|
8684
|
+
);
|
|
8685
|
+
}
|
|
8686
|
+
const designToken2 = await contentfulClient.designToken.upsert(params, {
|
|
8687
|
+
sys: {
|
|
8688
|
+
id: current.sys.id,
|
|
8689
|
+
type: "DesignToken",
|
|
8690
|
+
version: current.sys.version
|
|
8691
|
+
},
|
|
8692
|
+
name: args.name ?? current.name,
|
|
8693
|
+
type: args.type ?? current.type,
|
|
8694
|
+
...(args.metadata ?? current.metadata) && {
|
|
8695
|
+
metadata: args.metadata ?? current.metadata
|
|
8696
|
+
}
|
|
8697
|
+
});
|
|
8698
|
+
return createSuccessResponse("Design token updated successfully", {
|
|
8699
|
+
designToken: designToken2
|
|
8700
|
+
});
|
|
8701
|
+
}
|
|
8702
|
+
if (!args.name || !args.type) {
|
|
8703
|
+
throw new Error(
|
|
8704
|
+
"name and type are required when creating a new design token (no version supplied)."
|
|
8705
|
+
);
|
|
8706
|
+
}
|
|
8707
|
+
const designToken = await contentfulClient.designToken.upsert(params, {
|
|
8708
|
+
sys: { id: args.designTokenId, type: "DesignToken" },
|
|
8709
|
+
name: args.name,
|
|
8710
|
+
type: args.type,
|
|
8711
|
+
...args.metadata && { metadata: args.metadata }
|
|
8712
|
+
});
|
|
8713
|
+
return createSuccessResponse("Design token created successfully", {
|
|
8714
|
+
designToken
|
|
8715
|
+
});
|
|
8716
|
+
}
|
|
8717
|
+
return withErrorHandling(tool2, "Error upserting design token");
|
|
8718
|
+
}
|
|
8719
|
+
|
|
8720
|
+
// src/tools/exo/design-tokens/deleteDesignToken.ts
|
|
8721
|
+
import { z as z128 } from "zod";
|
|
8722
|
+
var DeleteDesignTokenToolParams = BaseToolSchema.extend({
|
|
8723
|
+
designTokenId: z128.string().describe("The ID of the design token to delete"),
|
|
8724
|
+
confirm: z128.boolean().optional().describe(
|
|
8725
|
+
"Set to true on the second call to actually perform the deletion. Required together with confirmToken."
|
|
8726
|
+
),
|
|
8727
|
+
confirmToken: z128.string().optional().describe(
|
|
8728
|
+
"Token returned by the preview call; must be supplied with confirm: true."
|
|
8729
|
+
)
|
|
8730
|
+
});
|
|
8731
|
+
function deleteDesignTokenTool(config) {
|
|
8732
|
+
async function tool2(args) {
|
|
8733
|
+
assertEnvironmentNotProtected(
|
|
8734
|
+
args.environmentId,
|
|
8735
|
+
config.protectedEnvironments
|
|
8736
|
+
);
|
|
8737
|
+
const params = {
|
|
8738
|
+
spaceId: args.spaceId,
|
|
8739
|
+
environmentId: args.environmentId,
|
|
8740
|
+
designTokenId: args.designTokenId
|
|
8741
|
+
};
|
|
8742
|
+
const contentfulClient = createExoToolClient(config, args);
|
|
8743
|
+
const designToken = await contentfulClient.designToken.get(params);
|
|
8744
|
+
const expectedToken = buildConfirmToken(
|
|
8745
|
+
"designToken",
|
|
8746
|
+
args.designTokenId,
|
|
8747
|
+
designToken.sys.version
|
|
8748
|
+
);
|
|
8749
|
+
if (args.confirm !== true || args.confirmToken !== expectedToken) {
|
|
8750
|
+
return createSuccessResponse(
|
|
8751
|
+
`${CONFIRMATION_MESSAGE_PREFIX} design token`,
|
|
8752
|
+
buildConfirmationPreview(
|
|
8753
|
+
"designToken",
|
|
8754
|
+
args.designTokenId,
|
|
8755
|
+
{ designToken },
|
|
8756
|
+
expectedToken
|
|
8757
|
+
)
|
|
8758
|
+
);
|
|
8759
|
+
}
|
|
8760
|
+
await contentfulClient.designToken.delete(params);
|
|
8761
|
+
return createSuccessResponse("Design token deleted successfully", {
|
|
8762
|
+
designTokenId: args.designTokenId
|
|
8763
|
+
});
|
|
8764
|
+
}
|
|
8765
|
+
return withErrorHandling(tool2, "Error deleting design token");
|
|
8766
|
+
}
|
|
8767
|
+
|
|
8768
|
+
// src/tools/exo/design-tokens/register.ts
|
|
8769
|
+
function createDesignTokenTools(config) {
|
|
8770
|
+
const getDesignToken = getDesignTokenTool(config);
|
|
8771
|
+
const listDesignTokens = listDesignTokensTool(config);
|
|
8772
|
+
const upsertDesignToken = upsertDesignTokenTool(config);
|
|
8773
|
+
const deleteDesignToken = deleteDesignTokenTool(config);
|
|
8774
|
+
return {
|
|
8775
|
+
getDesignToken: {
|
|
8776
|
+
title: "get_design_token",
|
|
8777
|
+
description: "Get details about a specific ExO design token (a named DTCG-typed value, such as a color, dimension, or typography token, referenced by token-backed design properties on components).",
|
|
8778
|
+
inputParams: GetDesignTokenToolParams.shape,
|
|
8779
|
+
annotations: {
|
|
8780
|
+
readOnlyHint: true,
|
|
8781
|
+
destructiveHint: false,
|
|
8782
|
+
openWorldHint: false
|
|
8783
|
+
},
|
|
8784
|
+
tool: getDesignToken
|
|
8785
|
+
},
|
|
8786
|
+
listDesignTokens: {
|
|
8787
|
+
title: "list_design_tokens",
|
|
8788
|
+
description: "List ExO design tokens in a space and environment. Returns a maximum of 10 items per request; use the pageNext cursor (returned in pages.next) to paginate.",
|
|
8789
|
+
inputParams: ListDesignTokensToolParams.shape,
|
|
8790
|
+
annotations: {
|
|
8791
|
+
readOnlyHint: true,
|
|
8792
|
+
destructiveHint: false,
|
|
8793
|
+
openWorldHint: false
|
|
8794
|
+
},
|
|
8795
|
+
tool: listDesignTokens
|
|
8796
|
+
},
|
|
8797
|
+
upsertDesignToken: {
|
|
8798
|
+
title: "upsert_design_token",
|
|
8799
|
+
description: "Create or update an ExO design token. To update an existing token, call get_design_token first and pass the returned sys.version as the version parameter; the handler merges your updates with the existing fields, so you only need to provide what changes. If the version is stale, the update is rejected and you must re-fetch with get_design_token. To create a new token, omit version and supply designTokenId, name, and type. Design tokens have no separate publish step: every upsert auto-publishes server-side, bumping sys.version by 2 (not 1) per call.",
|
|
8800
|
+
inputParams: UpsertDesignTokenToolParams.shape,
|
|
8801
|
+
annotations: {
|
|
8802
|
+
readOnlyHint: false,
|
|
8803
|
+
destructiveHint: false,
|
|
8804
|
+
idempotentHint: false,
|
|
8805
|
+
openWorldHint: false
|
|
8806
|
+
},
|
|
8807
|
+
tool: upsertDesignToken
|
|
8808
|
+
},
|
|
8809
|
+
deleteDesignToken: {
|
|
8810
|
+
title: "delete_design_token",
|
|
8811
|
+
description: "Delete an ExO design token. Two-phase: the first call (without confirm/confirmToken) returns a preview and a confirmToken. To complete the deletion, call again with the same designTokenId, confirm: true, and the confirmToken from the preview.",
|
|
8812
|
+
inputParams: DeleteDesignTokenToolParams.shape,
|
|
8813
|
+
annotations: {
|
|
8814
|
+
readOnlyHint: false,
|
|
8815
|
+
destructiveHint: true,
|
|
8816
|
+
idempotentHint: false,
|
|
8817
|
+
openWorldHint: false
|
|
8818
|
+
},
|
|
8819
|
+
tool: deleteDesignToken
|
|
8820
|
+
}
|
|
8821
|
+
};
|
|
8822
|
+
}
|
|
8823
|
+
|
|
8584
8824
|
// src/ContentfulMcpTools.ts
|
|
8585
8825
|
var ContentfulMcpTools = class {
|
|
8586
8826
|
config;
|
|
@@ -8713,6 +8953,12 @@ var ContentfulMcpTools = class {
|
|
|
8713
8953
|
getDataAssemblyTools() {
|
|
8714
8954
|
return createDataAssemblyTools(this.config);
|
|
8715
8955
|
}
|
|
8956
|
+
/**
|
|
8957
|
+
* Get ExO design token tools
|
|
8958
|
+
*/
|
|
8959
|
+
getDesignTokenTools() {
|
|
8960
|
+
return createDesignTokenTools(this.config);
|
|
8961
|
+
}
|
|
8716
8962
|
/**
|
|
8717
8963
|
* Get job tools (space-to-space migration)
|
|
8718
8964
|
*/
|