@contentful/mcp-tools 0.12.4 → 0.12.5
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 +107 -107
- package/dist/index.js +518 -498
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -336,10 +336,10 @@ var RESOURCE_DISPLAY_NAME = {
|
|
|
336
336
|
locale: "locale",
|
|
337
337
|
concept: "concept",
|
|
338
338
|
conceptScheme: "concept scheme",
|
|
339
|
-
|
|
339
|
+
component: "component",
|
|
340
340
|
experience: "experience",
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
experienceFragment: "experience fragment",
|
|
342
|
+
experienceTemplate: "experience template",
|
|
343
343
|
dataAssembly: "data assembly"
|
|
344
344
|
};
|
|
345
345
|
function buildConfirmationPreview(resource, id, details, confirmToken) {
|
|
@@ -2316,7 +2316,7 @@ var CORE_INVARIANTS = `# Core operating rules
|
|
|
2316
2316
|
- **Ask when ambiguous.** If multiple spaces or environments are available, ask the user which to use. Do not guess.`;
|
|
2317
2317
|
var SEARCHING_GUIDANCE = `# Searching for content
|
|
2318
2318
|
|
|
2319
|
-
- **Schema first.** When users ask about specific content, discover the relevant schema before searching: list the environment's available types and inspect a type's fields so you query on real field names. This prevents wasted queries. Use whichever primitives the environment exposes \u2014 classic content types and entries, or Experience Orchestration
|
|
2319
|
+
- **Schema first.** When users ask about specific content, discover the relevant schema before searching: list the environment's available types and inspect a type's fields so you query on real field names. This prevents wasted queries. Use whichever primitives the environment exposes \u2014 classic content types and entries, or Experience Orchestration components and experiences.
|
|
2320
2320
|
- **Then search.** Query using the correct type and field names. Prefer semantic search when the request is conceptual rather than an exact field match.
|
|
2321
2321
|
- **Retry thoughtfully.** If a query returns no results, retry 2-3 times: relax filters, use more general terms, or check for typos in field names.
|
|
2322
2322
|
- **Multi-step reference queries.** For requests that span references (e.g. "posts by Magnus"), first inspect the schema to confirm the reference field, then query for the referenced item to get its ID, then filter the primary query on that ID. If several items match, show them all and ask.`;
|
|
@@ -2329,7 +2329,7 @@ var CONVENTIONS_GUIDANCE = `# Response and workflow conventions
|
|
|
2329
2329
|
- **Prefer bulk.** If you would call the same tool many times, check whether it supports multiple IDs and condense into one call (respecting the 10-ID cap on publish-family operations).`;
|
|
2330
2330
|
var EXO_DISPOSITION = `# Tool disposition: Experience Orchestration by default
|
|
2331
2331
|
|
|
2332
|
-
Experience Orchestration (ExO) tools are enabled. Use ExO primitives \u2014
|
|
2332
|
+
Experience Orchestration (ExO) tools are enabled. Use ExO primitives \u2014 Components, Experiences, Experience Templates, Experience Fragments, and Data Assemblies \u2014 for all content modeling and authoring. Do not create classic content types or entries unless the user explicitly instructs you to. If you are unsure how to model something with ExO, inspect the tool schemas and proceed with ExO.`;
|
|
2333
2333
|
|
|
2334
2334
|
// src/tools/context/getInitialContextTool.ts
|
|
2335
2335
|
var GetInitialContextToolParams = z35.object({});
|
|
@@ -5711,39 +5711,39 @@ function createJobTools(config) {
|
|
|
5711
5711
|
};
|
|
5712
5712
|
}
|
|
5713
5713
|
|
|
5714
|
-
// src/tools/exo/
|
|
5714
|
+
// src/tools/exo/components/getComponent.ts
|
|
5715
5715
|
import { z as z83 } from "zod";
|
|
5716
|
-
var
|
|
5717
|
-
|
|
5716
|
+
var GetComponentToolParams = BaseToolSchema.extend({
|
|
5717
|
+
componentId: z83.string().describe("The ID of the component to retrieve details for")
|
|
5718
5718
|
});
|
|
5719
|
-
function
|
|
5719
|
+
function getComponentTool(config) {
|
|
5720
5720
|
async function tool2(args) {
|
|
5721
5721
|
const contentfulClient = createToolClient(config, args);
|
|
5722
|
-
const
|
|
5722
|
+
const component = await contentfulClient.component.get({
|
|
5723
5723
|
spaceId: args.spaceId,
|
|
5724
5724
|
environmentId: args.environmentId,
|
|
5725
|
-
|
|
5725
|
+
componentId: args.componentId
|
|
5726
5726
|
});
|
|
5727
|
-
return createSuccessResponse("Component
|
|
5728
|
-
|
|
5727
|
+
return createSuccessResponse("Component retrieved successfully", {
|
|
5728
|
+
component
|
|
5729
5729
|
});
|
|
5730
5730
|
}
|
|
5731
|
-
return withErrorHandling(tool2, "Error retrieving component
|
|
5731
|
+
return withErrorHandling(tool2, "Error retrieving component");
|
|
5732
5732
|
}
|
|
5733
5733
|
|
|
5734
|
-
// src/tools/exo/
|
|
5734
|
+
// src/tools/exo/components/listComponents.ts
|
|
5735
5735
|
import { z as z84 } from "zod";
|
|
5736
|
-
var
|
|
5737
|
-
limit: z84.number().optional().describe("Maximum number of
|
|
5736
|
+
var ListComponentsToolParams = BaseToolSchema.extend({
|
|
5737
|
+
limit: z84.number().optional().describe("Maximum number of components to return (max 10)"),
|
|
5738
5738
|
pageNext: z84.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
5739
5739
|
pagePrev: z84.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
5740
|
-
order: z84.string().optional().describe("Order
|
|
5740
|
+
order: z84.string().optional().describe("Order components by this field (e.g. sys.createdAt)")
|
|
5741
5741
|
});
|
|
5742
|
-
function
|
|
5742
|
+
function listComponentsTool(config) {
|
|
5743
5743
|
async function tool2(args) {
|
|
5744
5744
|
const contentfulClient = createToolClient(config, args);
|
|
5745
5745
|
const cursorParam = args.pageNext ? { pageNext: args.pageNext } : args.pagePrev ? { pagePrev: args.pagePrev } : {};
|
|
5746
|
-
const
|
|
5746
|
+
const components = await contentfulClient.component.getMany({
|
|
5747
5747
|
spaceId: args.spaceId,
|
|
5748
5748
|
environmentId: args.environmentId,
|
|
5749
5749
|
query: {
|
|
@@ -5752,29 +5752,29 @@ function listComponentTypesTool(config) {
|
|
|
5752
5752
|
...cursorParam
|
|
5753
5753
|
}
|
|
5754
5754
|
});
|
|
5755
|
-
const summarized = summarizeData(
|
|
5755
|
+
const summarized = summarizeData(components, {
|
|
5756
5756
|
maxItems: 10,
|
|
5757
|
-
remainingMessage: "To see more
|
|
5757
|
+
remainingMessage: "To see more components, ask me to retrieve the next page using the pageNext cursor."
|
|
5758
5758
|
});
|
|
5759
|
-
return createSuccessResponse("
|
|
5760
|
-
|
|
5761
|
-
total:
|
|
5762
|
-
limit:
|
|
5763
|
-
pages:
|
|
5759
|
+
return createSuccessResponse("Components retrieved successfully", {
|
|
5760
|
+
components: summarized,
|
|
5761
|
+
total: components.total,
|
|
5762
|
+
limit: components.limit,
|
|
5763
|
+
pages: components.pages
|
|
5764
5764
|
});
|
|
5765
5765
|
}
|
|
5766
|
-
return withErrorHandling(tool2, "Error listing
|
|
5766
|
+
return withErrorHandling(tool2, "Error listing components");
|
|
5767
5767
|
}
|
|
5768
5768
|
|
|
5769
|
-
// src/tools/exo/
|
|
5769
|
+
// src/tools/exo/components/createComponent.ts
|
|
5770
5770
|
import { z as z86 } from "zod";
|
|
5771
5771
|
|
|
5772
|
-
// src/types/
|
|
5772
|
+
// src/types/exoSchemas.ts
|
|
5773
5773
|
import { z as z85 } from "zod";
|
|
5774
5774
|
var URN_EXAMPLES = {
|
|
5775
|
-
"Contentful:
|
|
5776
|
-
"Contentful:
|
|
5777
|
-
"Contentful:
|
|
5775
|
+
"Contentful:Component": "crn:contentful:::experience:spaces/{spaceId}/environments/{envId}/components/{id}",
|
|
5776
|
+
"Contentful:ExperienceFragment": "crn:contentful:::experience:spaces/{spaceId}/environments/{envId}/experienceFragments/{id}",
|
|
5777
|
+
"Contentful:ExperienceTemplate": "crn:contentful:::experience:spaces/{spaceId}/environments/{envId}/experienceTemplates/{id}",
|
|
5778
5778
|
"Contentful:DataAssembly": "crn:contentful:::experience:spaces/{spaceId}/environments/{envId}/dataAssemblies/{id}"
|
|
5779
5779
|
};
|
|
5780
5780
|
var resourceLinkSchema2 = (linkType) => {
|
|
@@ -5795,8 +5795,15 @@ var linkSchema2 = (linkType) => z85.object({
|
|
|
5795
5795
|
id: z85.string()
|
|
5796
5796
|
})
|
|
5797
5797
|
});
|
|
5798
|
-
var
|
|
5799
|
-
|
|
5798
|
+
var ComponentResourceLinkSchema = resourceLinkSchema2(
|
|
5799
|
+
"Contentful:Component"
|
|
5800
|
+
);
|
|
5801
|
+
var ExperienceFragmentResourceLinkSchema = resourceLinkSchema2(
|
|
5802
|
+
"Contentful:ExperienceFragment"
|
|
5803
|
+
);
|
|
5804
|
+
var ExperienceTemplateResourceLinkSchema = resourceLinkSchema2(
|
|
5805
|
+
"Contentful:ExperienceTemplate"
|
|
5806
|
+
);
|
|
5800
5807
|
var ViewportSchema = z85.object({
|
|
5801
5808
|
id: z85.string().describe("Viewport identifier"),
|
|
5802
5809
|
query: z85.string().describe("CSS media query string"),
|
|
@@ -5909,19 +5916,21 @@ var DesignTokenValueSchema = z85.object({
|
|
|
5909
5916
|
type: z85.literal("DesignToken"),
|
|
5910
5917
|
value: z85.string().min(1).describe("Design token reference (non-empty)")
|
|
5911
5918
|
});
|
|
5912
|
-
var TokenBackedDesignPropertySchema = DesignPropertyCommonFieldsSchema.extend(
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
z85.
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5919
|
+
var TokenBackedDesignPropertySchema = DesignPropertyCommonFieldsSchema.extend(
|
|
5920
|
+
{
|
|
5921
|
+
type: z85.enum(DTCG_DESIGN_PROPERTY_TYPES),
|
|
5922
|
+
fallbackValue: DesignTokenValueSchema.optional().describe(
|
|
5923
|
+
"Design-token-backed fallback value for this design property"
|
|
5924
|
+
),
|
|
5925
|
+
allowedResources: z85.array(
|
|
5926
|
+
z85.object({
|
|
5927
|
+
type: z85.literal("DesignToken"),
|
|
5928
|
+
value: z85.string(),
|
|
5929
|
+
name: z85.string().optional()
|
|
5930
|
+
})
|
|
5931
|
+
).optional().describe("Allowed design token resources")
|
|
5932
|
+
}
|
|
5933
|
+
);
|
|
5925
5934
|
var DesignPropertySchema = z85.union([
|
|
5926
5935
|
StringDesignPropertySchema,
|
|
5927
5936
|
BooleanDesignPropertySchema,
|
|
@@ -5963,17 +5972,19 @@ var SlotDefinitionSchema = z85.object({
|
|
|
5963
5972
|
).describe("Slot cardinality validations"),
|
|
5964
5973
|
allowedResources: z85.array(
|
|
5965
5974
|
z85.object({
|
|
5966
|
-
type: z85.literal("Contentful:
|
|
5975
|
+
type: z85.literal("Contentful:Component"),
|
|
5967
5976
|
source: z85.literal(COMPONENT_TYPE_ALLOWED_RESOURCE_SOURCE),
|
|
5968
|
-
allowedTypes: z85.array(z85.string()).describe("IDs of
|
|
5977
|
+
allowedTypes: z85.array(z85.string()).describe("IDs of components allowed in this slot")
|
|
5969
5978
|
})
|
|
5970
|
-
).optional().describe("Constrains which
|
|
5979
|
+
).optional().describe("Constrains which components may be placed in this slot")
|
|
5971
5980
|
});
|
|
5972
|
-
var
|
|
5981
|
+
var ExperienceFragmentNodeSchema = z85.object({
|
|
5973
5982
|
id: z85.string().describe("Node identifier"),
|
|
5974
5983
|
name: z85.string().optional().describe("Optional display name"),
|
|
5975
|
-
nodeType: z85.literal("
|
|
5976
|
-
|
|
5984
|
+
nodeType: z85.literal("ExperienceFragment").describe('Must be "ExperienceFragment"'),
|
|
5985
|
+
experienceFragment: ExperienceFragmentResourceLinkSchema.describe(
|
|
5986
|
+
"Resource link to the referenced experience fragment"
|
|
5987
|
+
)
|
|
5977
5988
|
});
|
|
5978
5989
|
var SlotNodeSchema = z85.object({
|
|
5979
5990
|
id: z85.string().describe("Node identifier"),
|
|
@@ -5981,15 +5992,15 @@ var SlotNodeSchema = z85.object({
|
|
|
5981
5992
|
slotId: z85.string().describe("ID of the slot definition to render")
|
|
5982
5993
|
});
|
|
5983
5994
|
var TreeNodeSchema = z85.lazy(
|
|
5984
|
-
() => z85.union([ComponentNodeSchema,
|
|
5995
|
+
() => z85.union([ComponentNodeSchema, ExperienceFragmentNodeSchema, SlotNodeSchema])
|
|
5985
5996
|
);
|
|
5986
5997
|
var ComponentNodeSchema = z85.lazy(
|
|
5987
5998
|
() => z85.object({
|
|
5988
5999
|
id: z85.string().describe("Node identifier"),
|
|
5989
6000
|
name: z85.string().optional().describe("Optional display name"),
|
|
5990
6001
|
nodeType: z85.literal("Component").describe('Must be "Component"'),
|
|
5991
|
-
|
|
5992
|
-
"Resource link to the component
|
|
6002
|
+
component: ComponentResourceLinkSchema.describe(
|
|
6003
|
+
"Resource link to the component to render"
|
|
5993
6004
|
),
|
|
5994
6005
|
contentProperties: z85.union([
|
|
5995
6006
|
z85.record(z85.string(), z85.unknown()),
|
|
@@ -6012,7 +6023,9 @@ var ExoMetadataSchema = z85.object({
|
|
|
6012
6023
|
var ExperienceMetadataSchema = ExoMetadataSchema.extend({
|
|
6013
6024
|
name: z85.string().optional().describe("Variant label for this metadata entry")
|
|
6014
6025
|
});
|
|
6015
|
-
var DataAssemblyResourceLinkSchema = resourceLinkSchema2(
|
|
6026
|
+
var DataAssemblyResourceLinkSchema = resourceLinkSchema2(
|
|
6027
|
+
"Contentful:DataAssembly"
|
|
6028
|
+
);
|
|
6016
6029
|
var ExperienceContentBindingsSchema = z85.object({
|
|
6017
6030
|
sys: DataAssemblyResourceLinkSchema.shape.sys,
|
|
6018
6031
|
parameters: z85.record(
|
|
@@ -6026,29 +6039,29 @@ var ExperienceContentBindingsSchema = z85.object({
|
|
|
6026
6039
|
})
|
|
6027
6040
|
).describe("Parameter bindings keyed by parameter ID")
|
|
6028
6041
|
});
|
|
6029
|
-
var
|
|
6042
|
+
var InlineExperienceFragmentNodeSchema = z85.lazy(
|
|
6030
6043
|
() => z85.object({
|
|
6031
6044
|
id: z85.string().describe("Node identifier"),
|
|
6032
|
-
nodeType: z85.literal("
|
|
6033
|
-
|
|
6034
|
-
"Resource link to the component
|
|
6045
|
+
nodeType: z85.literal("InlineExperienceFragment").describe('Must be "InlineExperienceFragment"'),
|
|
6046
|
+
component: ComponentResourceLinkSchema.describe(
|
|
6047
|
+
"Resource link to the component this inline experience fragment renders"
|
|
6035
6048
|
),
|
|
6036
|
-
designProperties: z85.record(z85.string(), DimensionedDesignPropertyValueSchema).describe("Design property values for this inline fragment"),
|
|
6049
|
+
designProperties: z85.record(z85.string(), DimensionedDesignPropertyValueSchema).describe("Design property values for this inline experience fragment"),
|
|
6037
6050
|
contentBindings: ExperienceContentBindingsSchema.optional().describe(
|
|
6038
|
-
"Optional content bindings linking this inline fragment to a data assembly"
|
|
6051
|
+
"Optional content bindings linking this inline experience fragment to a data assembly"
|
|
6039
6052
|
),
|
|
6040
6053
|
slots: z85.record(z85.string(), z85.array(ExperienceSlotNodeSchema)).optional().describe("Child slot contents keyed by slot ID")
|
|
6041
6054
|
})
|
|
6042
6055
|
);
|
|
6043
6056
|
var ExperienceSlotNodeSchema = z85.lazy(
|
|
6044
|
-
() => z85.union([
|
|
6057
|
+
() => z85.union([ExperienceFragmentNodeSchema, InlineExperienceFragmentNodeSchema])
|
|
6045
6058
|
);
|
|
6046
6059
|
|
|
6047
|
-
// src/tools/exo/
|
|
6048
|
-
var
|
|
6049
|
-
name: z86.string().describe("The name of the component
|
|
6050
|
-
description: z86.string().describe("Description of the component
|
|
6051
|
-
viewports: z86.array(ViewportSchema).describe("Viewport definitions for the component
|
|
6060
|
+
// src/tools/exo/components/createComponent.ts
|
|
6061
|
+
var CreateComponentToolParams = BaseToolSchema.extend({
|
|
6062
|
+
name: z86.string().describe("The name of the component"),
|
|
6063
|
+
description: z86.string().describe("Description of the component"),
|
|
6064
|
+
viewports: z86.array(ViewportSchema).describe("Viewport definitions for the component (may be empty)"),
|
|
6052
6065
|
contentProperties: z86.array(ContentPropertySchema).describe("Content property definitions (may be empty)"),
|
|
6053
6066
|
designProperties: z86.array(DesignPropertySchema).describe("Design property definitions (may be empty)"),
|
|
6054
6067
|
componentTree: z86.array(TreeNodeSchema).optional().describe("Optional component tree node definitions"),
|
|
@@ -6057,14 +6070,14 @@ var CreateComponentTypeToolParams = BaseToolSchema.extend({
|
|
|
6057
6070
|
"Optional ExO metadata (tags, concepts)"
|
|
6058
6071
|
)
|
|
6059
6072
|
});
|
|
6060
|
-
function
|
|
6073
|
+
function createComponentTool(config) {
|
|
6061
6074
|
async function tool2(args) {
|
|
6062
6075
|
assertEnvironmentNotProtected(
|
|
6063
6076
|
args.environmentId,
|
|
6064
6077
|
config.protectedEnvironments
|
|
6065
6078
|
);
|
|
6066
6079
|
const contentfulClient = createToolClient(config, args);
|
|
6067
|
-
const
|
|
6080
|
+
const component = await contentfulClient.component.create(
|
|
6068
6081
|
{ spaceId: args.spaceId, environmentId: args.environmentId },
|
|
6069
6082
|
{
|
|
6070
6083
|
name: args.name,
|
|
@@ -6077,22 +6090,22 @@ function createComponentTypeTool(config) {
|
|
|
6077
6090
|
...args.metadata && { metadata: args.metadata }
|
|
6078
6091
|
}
|
|
6079
6092
|
);
|
|
6080
|
-
return createSuccessResponse("Component
|
|
6081
|
-
|
|
6093
|
+
return createSuccessResponse("Component created successfully", {
|
|
6094
|
+
component
|
|
6082
6095
|
});
|
|
6083
6096
|
}
|
|
6084
|
-
return withErrorHandling(tool2, "Error creating component
|
|
6097
|
+
return withErrorHandling(tool2, "Error creating component");
|
|
6085
6098
|
}
|
|
6086
6099
|
|
|
6087
|
-
// src/tools/exo/
|
|
6100
|
+
// src/tools/exo/components/upsertComponent.ts
|
|
6088
6101
|
import { z as z87 } from "zod";
|
|
6089
|
-
var
|
|
6090
|
-
|
|
6102
|
+
var UpsertComponentToolParams = BaseToolSchema.extend({
|
|
6103
|
+
componentId: z87.string().describe("The ID of the component to update"),
|
|
6091
6104
|
version: z87.number().describe(
|
|
6092
|
-
"REQUIRED. The component
|
|
6105
|
+
"REQUIRED. The component's sys.version as returned by get_component. You must call get_component first to read the current state and version. The update is rejected if this does not match the current version, which means the component changed since you read it."
|
|
6093
6106
|
),
|
|
6094
|
-
name: z87.string().optional().describe("The name of the component
|
|
6095
|
-
description: z87.string().optional().describe("Description of the component
|
|
6107
|
+
name: z87.string().optional().describe("The name of the component"),
|
|
6108
|
+
description: z87.string().optional().describe("Description of the component"),
|
|
6096
6109
|
viewports: z87.array(ViewportSchema).optional().describe("Viewport definitions; replaces existing viewports if provided"),
|
|
6097
6110
|
contentProperties: z87.array(ContentPropertySchema).optional().describe("Content property definitions; replaces existing if provided"),
|
|
6098
6111
|
designProperties: z87.array(DesignPropertySchema).optional().describe("Design property definitions; replaces existing if provided"),
|
|
@@ -6102,7 +6115,7 @@ var UpsertComponentTypeToolParams = BaseToolSchema.extend({
|
|
|
6102
6115
|
"ExO metadata (tags, concepts); replaces existing if provided"
|
|
6103
6116
|
)
|
|
6104
6117
|
});
|
|
6105
|
-
function
|
|
6118
|
+
function upsertComponentTool(config) {
|
|
6106
6119
|
async function tool2(args) {
|
|
6107
6120
|
assertEnvironmentNotProtected(
|
|
6108
6121
|
args.environmentId,
|
|
@@ -6111,19 +6124,19 @@ function upsertComponentTypeTool(config) {
|
|
|
6111
6124
|
const params = {
|
|
6112
6125
|
spaceId: args.spaceId,
|
|
6113
6126
|
environmentId: args.environmentId,
|
|
6114
|
-
|
|
6127
|
+
componentId: args.componentId
|
|
6115
6128
|
};
|
|
6116
6129
|
const contentfulClient = createToolClient(config, args);
|
|
6117
|
-
const current = await contentfulClient.
|
|
6130
|
+
const current = await contentfulClient.component.get(params);
|
|
6118
6131
|
if (args.version !== current.sys.version) {
|
|
6119
6132
|
throw new Error(
|
|
6120
|
-
`Version conflict: the component
|
|
6133
|
+
`Version conflict: the component has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the component with get_component and retry the update with the latest sys.version.`
|
|
6121
6134
|
);
|
|
6122
6135
|
}
|
|
6123
|
-
const
|
|
6136
|
+
const component = await contentfulClient.component.upsert(params, {
|
|
6124
6137
|
sys: {
|
|
6125
6138
|
id: current.sys.id,
|
|
6126
|
-
type: "
|
|
6139
|
+
type: "Component",
|
|
6127
6140
|
version: current.sys.version
|
|
6128
6141
|
},
|
|
6129
6142
|
name: args.name ?? current.name,
|
|
@@ -6136,17 +6149,17 @@ function upsertComponentTypeTool(config) {
|
|
|
6136
6149
|
...args.metadata ?? current.metadata ? { metadata: args.metadata ?? current.metadata } : {},
|
|
6137
6150
|
...current.dataAssemblies ? { dataAssemblies: current.dataAssemblies } : {}
|
|
6138
6151
|
});
|
|
6139
|
-
return createSuccessResponse("Component
|
|
6140
|
-
|
|
6152
|
+
return createSuccessResponse("Component updated successfully", {
|
|
6153
|
+
component
|
|
6141
6154
|
});
|
|
6142
6155
|
}
|
|
6143
|
-
return withErrorHandling(tool2, "Error updating component
|
|
6156
|
+
return withErrorHandling(tool2, "Error updating component");
|
|
6144
6157
|
}
|
|
6145
6158
|
|
|
6146
|
-
// src/tools/exo/
|
|
6159
|
+
// src/tools/exo/components/deleteComponent.ts
|
|
6147
6160
|
import { z as z88 } from "zod";
|
|
6148
|
-
var
|
|
6149
|
-
|
|
6161
|
+
var DeleteComponentToolParams = BaseToolSchema.extend({
|
|
6162
|
+
componentId: z88.string().describe("The ID of the component to delete"),
|
|
6150
6163
|
confirm: z88.boolean().optional().describe(
|
|
6151
6164
|
"Set to true on the second call to actually perform the deletion. Required together with confirmToken."
|
|
6152
6165
|
),
|
|
@@ -6154,7 +6167,7 @@ var DeleteComponentTypeToolParams = BaseToolSchema.extend({
|
|
|
6154
6167
|
"Token returned by the preview call; must be supplied with confirm: true."
|
|
6155
6168
|
)
|
|
6156
6169
|
});
|
|
6157
|
-
function
|
|
6170
|
+
function deleteComponentTool(config) {
|
|
6158
6171
|
async function tool2(args) {
|
|
6159
6172
|
assertEnvironmentNotProtected(
|
|
6160
6173
|
args.environmentId,
|
|
@@ -6163,43 +6176,43 @@ function deleteComponentTypeTool(config) {
|
|
|
6163
6176
|
const params = {
|
|
6164
6177
|
spaceId: args.spaceId,
|
|
6165
6178
|
environmentId: args.environmentId,
|
|
6166
|
-
|
|
6179
|
+
componentId: args.componentId
|
|
6167
6180
|
};
|
|
6168
6181
|
const contentfulClient = createToolClient(config, args);
|
|
6169
|
-
const
|
|
6182
|
+
const component = await contentfulClient.component.get(params);
|
|
6170
6183
|
const expectedToken = buildConfirmToken(
|
|
6171
|
-
"
|
|
6172
|
-
args.
|
|
6173
|
-
|
|
6184
|
+
"component",
|
|
6185
|
+
args.componentId,
|
|
6186
|
+
component.sys.version
|
|
6174
6187
|
);
|
|
6175
6188
|
if (args.confirm !== true || args.confirmToken !== expectedToken) {
|
|
6176
6189
|
return createSuccessResponse(
|
|
6177
|
-
`${CONFIRMATION_MESSAGE_PREFIX} component
|
|
6190
|
+
`${CONFIRMATION_MESSAGE_PREFIX} component`,
|
|
6178
6191
|
buildConfirmationPreview(
|
|
6179
|
-
"
|
|
6180
|
-
args.
|
|
6181
|
-
{
|
|
6192
|
+
"component",
|
|
6193
|
+
args.componentId,
|
|
6194
|
+
{ component },
|
|
6182
6195
|
expectedToken
|
|
6183
6196
|
)
|
|
6184
6197
|
);
|
|
6185
6198
|
}
|
|
6186
|
-
await contentfulClient.
|
|
6187
|
-
return createSuccessResponse("Component
|
|
6188
|
-
|
|
6199
|
+
await contentfulClient.component.delete(params);
|
|
6200
|
+
return createSuccessResponse("Component deleted successfully", {
|
|
6201
|
+
componentId: args.componentId
|
|
6189
6202
|
});
|
|
6190
6203
|
}
|
|
6191
|
-
return withErrorHandling(tool2, "Error deleting component
|
|
6204
|
+
return withErrorHandling(tool2, "Error deleting component");
|
|
6192
6205
|
}
|
|
6193
6206
|
|
|
6194
|
-
// src/tools/exo/
|
|
6207
|
+
// src/tools/exo/components/publishComponent.ts
|
|
6195
6208
|
import { z as z89 } from "zod";
|
|
6196
|
-
var
|
|
6197
|
-
|
|
6209
|
+
var PublishComponentToolParams = BaseToolSchema.extend({
|
|
6210
|
+
componentId: z89.string().describe("The ID of the component to publish"),
|
|
6198
6211
|
version: z89.number().describe(
|
|
6199
|
-
"REQUIRED. The component
|
|
6212
|
+
"REQUIRED. The component's sys.version as returned by get_component. You must call get_component first to read the current state and version. The publish is rejected if this does not match the current version, which means the component changed since you read it."
|
|
6200
6213
|
)
|
|
6201
6214
|
});
|
|
6202
|
-
function
|
|
6215
|
+
function publishComponentTool(config) {
|
|
6203
6216
|
async function tool2(args) {
|
|
6204
6217
|
assertEnvironmentNotProtected(
|
|
6205
6218
|
args.environmentId,
|
|
@@ -6208,35 +6221,35 @@ function publishComponentTypeTool(config) {
|
|
|
6208
6221
|
const params = {
|
|
6209
6222
|
spaceId: args.spaceId,
|
|
6210
6223
|
environmentId: args.environmentId,
|
|
6211
|
-
|
|
6224
|
+
componentId: args.componentId
|
|
6212
6225
|
};
|
|
6213
6226
|
const contentfulClient = createToolClient(config, args);
|
|
6214
|
-
const current = await contentfulClient.
|
|
6227
|
+
const current = await contentfulClient.component.get(params);
|
|
6215
6228
|
if (args.version !== current.sys.version) {
|
|
6216
6229
|
throw new Error(
|
|
6217
|
-
`Version conflict: the component
|
|
6230
|
+
`Version conflict: the component has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the component with get_component and retry with the latest sys.version.`
|
|
6218
6231
|
);
|
|
6219
6232
|
}
|
|
6220
|
-
const
|
|
6233
|
+
const component = await contentfulClient.component.publish({
|
|
6221
6234
|
...params,
|
|
6222
6235
|
version: args.version
|
|
6223
6236
|
});
|
|
6224
|
-
return createSuccessResponse("Component
|
|
6225
|
-
|
|
6237
|
+
return createSuccessResponse("Component published successfully", {
|
|
6238
|
+
component
|
|
6226
6239
|
});
|
|
6227
6240
|
}
|
|
6228
|
-
return withErrorHandling(tool2, "Error publishing component
|
|
6241
|
+
return withErrorHandling(tool2, "Error publishing component");
|
|
6229
6242
|
}
|
|
6230
6243
|
|
|
6231
|
-
// src/tools/exo/
|
|
6244
|
+
// src/tools/exo/components/unpublishComponent.ts
|
|
6232
6245
|
import { z as z90 } from "zod";
|
|
6233
|
-
var
|
|
6234
|
-
|
|
6246
|
+
var UnpublishComponentToolParams = BaseToolSchema.extend({
|
|
6247
|
+
componentId: z90.string().describe("The ID of the component to unpublish"),
|
|
6235
6248
|
version: z90.number().describe(
|
|
6236
|
-
"REQUIRED. The component
|
|
6249
|
+
"REQUIRED. The component's sys.version as returned by get_component. You must call get_component first to read the current state and version. The unpublish is rejected if this does not match the current version, which means the component changed since you read it."
|
|
6237
6250
|
)
|
|
6238
6251
|
});
|
|
6239
|
-
function
|
|
6252
|
+
function unpublishComponentTool(config) {
|
|
6240
6253
|
async function tool2(args) {
|
|
6241
6254
|
assertEnvironmentNotProtected(
|
|
6242
6255
|
args.environmentId,
|
|
@@ -6245,153 +6258,153 @@ function unpublishComponentTypeTool(config) {
|
|
|
6245
6258
|
const params = {
|
|
6246
6259
|
spaceId: args.spaceId,
|
|
6247
6260
|
environmentId: args.environmentId,
|
|
6248
|
-
|
|
6261
|
+
componentId: args.componentId
|
|
6249
6262
|
};
|
|
6250
6263
|
const contentfulClient = createToolClient(config, args);
|
|
6251
|
-
const current = await contentfulClient.
|
|
6264
|
+
const current = await contentfulClient.component.get(params);
|
|
6252
6265
|
if (args.version !== current.sys.version) {
|
|
6253
6266
|
throw new Error(
|
|
6254
|
-
`Version conflict: the component
|
|
6267
|
+
`Version conflict: the component has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the component with get_component and retry with the latest sys.version.`
|
|
6255
6268
|
);
|
|
6256
6269
|
}
|
|
6257
|
-
const
|
|
6270
|
+
const component = await contentfulClient.component.unpublish({
|
|
6258
6271
|
...params,
|
|
6259
6272
|
version: args.version
|
|
6260
6273
|
});
|
|
6261
|
-
return createSuccessResponse("Component
|
|
6262
|
-
|
|
6274
|
+
return createSuccessResponse("Component unpublished successfully", {
|
|
6275
|
+
component
|
|
6263
6276
|
});
|
|
6264
6277
|
}
|
|
6265
|
-
return withErrorHandling(tool2, "Error unpublishing component
|
|
6278
|
+
return withErrorHandling(tool2, "Error unpublishing component");
|
|
6266
6279
|
}
|
|
6267
6280
|
|
|
6268
|
-
// src/tools/exo/
|
|
6269
|
-
function
|
|
6270
|
-
const
|
|
6271
|
-
const
|
|
6272
|
-
const
|
|
6273
|
-
const
|
|
6274
|
-
const
|
|
6275
|
-
const
|
|
6276
|
-
const
|
|
6281
|
+
// src/tools/exo/components/register.ts
|
|
6282
|
+
function createComponentTools(config) {
|
|
6283
|
+
const getComponent = getComponentTool(config);
|
|
6284
|
+
const listComponents = listComponentsTool(config);
|
|
6285
|
+
const createComponent = createComponentTool(config);
|
|
6286
|
+
const upsertComponent = upsertComponentTool(config);
|
|
6287
|
+
const deleteComponent = deleteComponentTool(config);
|
|
6288
|
+
const publishComponent = publishComponentTool(config);
|
|
6289
|
+
const unpublishComponent = unpublishComponentTool(config);
|
|
6277
6290
|
return {
|
|
6278
|
-
|
|
6279
|
-
title: "
|
|
6280
|
-
description: "Get details about a specific ExO component
|
|
6281
|
-
inputParams:
|
|
6291
|
+
getComponent: {
|
|
6292
|
+
title: "get_component",
|
|
6293
|
+
description: "Get details about a specific ExO component (a reusable section/pattern template defining slots, content properties, and design properties).",
|
|
6294
|
+
inputParams: GetComponentToolParams.shape,
|
|
6282
6295
|
annotations: {
|
|
6283
6296
|
readOnlyHint: true,
|
|
6284
6297
|
destructiveHint: false,
|
|
6285
6298
|
openWorldHint: false
|
|
6286
6299
|
},
|
|
6287
|
-
tool:
|
|
6300
|
+
tool: getComponent
|
|
6288
6301
|
},
|
|
6289
|
-
|
|
6290
|
-
title: "
|
|
6291
|
-
description: "List ExO
|
|
6292
|
-
inputParams:
|
|
6302
|
+
listComponents: {
|
|
6303
|
+
title: "list_components",
|
|
6304
|
+
description: "List ExO components in a space and environment. Returns a maximum of 10 items per request; use the pageNext cursor (returned in pages.next) to paginate.",
|
|
6305
|
+
inputParams: ListComponentsToolParams.shape,
|
|
6293
6306
|
annotations: {
|
|
6294
6307
|
readOnlyHint: true,
|
|
6295
6308
|
destructiveHint: false,
|
|
6296
6309
|
openWorldHint: false
|
|
6297
6310
|
},
|
|
6298
|
-
tool:
|
|
6311
|
+
tool: listComponents
|
|
6299
6312
|
},
|
|
6300
|
-
|
|
6301
|
-
title: "
|
|
6302
|
-
description: "Create a new ExO component
|
|
6303
|
-
inputParams:
|
|
6313
|
+
createComponent: {
|
|
6314
|
+
title: "create_component",
|
|
6315
|
+
description: "Create a new ExO component.",
|
|
6316
|
+
inputParams: CreateComponentToolParams.shape,
|
|
6304
6317
|
annotations: {
|
|
6305
6318
|
readOnlyHint: false,
|
|
6306
6319
|
destructiveHint: false,
|
|
6307
6320
|
idempotentHint: false,
|
|
6308
6321
|
openWorldHint: false
|
|
6309
6322
|
},
|
|
6310
|
-
tool:
|
|
6323
|
+
tool: createComponent
|
|
6311
6324
|
},
|
|
6312
|
-
|
|
6313
|
-
title: "
|
|
6314
|
-
description: "Update an existing ExO component
|
|
6315
|
-
inputParams:
|
|
6325
|
+
upsertComponent: {
|
|
6326
|
+
title: "upsert_component",
|
|
6327
|
+
description: "Update an existing ExO component. You MUST call get_component first to read the current state, then pass the sys.version you received as the version parameter. The handler merges your updates with the existing component fields, so you only need to provide the fields you want to change. If the version is stale (the component changed since you read it), the update is rejected and you must re-fetch with get_component.",
|
|
6328
|
+
inputParams: UpsertComponentToolParams.shape,
|
|
6316
6329
|
annotations: {
|
|
6317
6330
|
readOnlyHint: false,
|
|
6318
6331
|
destructiveHint: false,
|
|
6319
6332
|
idempotentHint: false,
|
|
6320
6333
|
openWorldHint: false
|
|
6321
6334
|
},
|
|
6322
|
-
tool:
|
|
6335
|
+
tool: upsertComponent
|
|
6323
6336
|
},
|
|
6324
|
-
|
|
6325
|
-
title: "
|
|
6326
|
-
description: "Delete an ExO component
|
|
6327
|
-
inputParams:
|
|
6337
|
+
deleteComponent: {
|
|
6338
|
+
title: "delete_component",
|
|
6339
|
+
description: "Delete an ExO component. Two-phase: the first call (without confirm/confirmToken) returns a preview and a confirmToken. To complete the deletion, call again with the same componentId, confirm: true, and the confirmToken from the preview.",
|
|
6340
|
+
inputParams: DeleteComponentToolParams.shape,
|
|
6328
6341
|
annotations: {
|
|
6329
6342
|
readOnlyHint: false,
|
|
6330
6343
|
destructiveHint: true,
|
|
6331
6344
|
idempotentHint: false,
|
|
6332
6345
|
openWorldHint: false
|
|
6333
6346
|
},
|
|
6334
|
-
tool:
|
|
6347
|
+
tool: deleteComponent
|
|
6335
6348
|
},
|
|
6336
|
-
|
|
6337
|
-
title: "
|
|
6338
|
-
description: "Publish an ExO component
|
|
6339
|
-
inputParams:
|
|
6349
|
+
publishComponent: {
|
|
6350
|
+
title: "publish_component",
|
|
6351
|
+
description: "Publish an ExO component. You MUST call get_component first and pass the returned sys.version as the version parameter. If the version is stale the operation is rejected and you must re-fetch with get_component.",
|
|
6352
|
+
inputParams: PublishComponentToolParams.shape,
|
|
6340
6353
|
annotations: {
|
|
6341
6354
|
readOnlyHint: false,
|
|
6342
6355
|
destructiveHint: true,
|
|
6343
6356
|
idempotentHint: true,
|
|
6344
6357
|
openWorldHint: false
|
|
6345
6358
|
},
|
|
6346
|
-
tool:
|
|
6359
|
+
tool: publishComponent
|
|
6347
6360
|
},
|
|
6348
|
-
|
|
6349
|
-
title: "
|
|
6350
|
-
description: "Unpublish an ExO component
|
|
6351
|
-
inputParams:
|
|
6361
|
+
unpublishComponent: {
|
|
6362
|
+
title: "unpublish_component",
|
|
6363
|
+
description: "Unpublish an ExO component. You MUST call get_component first and pass the returned sys.version as the version parameter. If the version is stale the operation is rejected and you must re-fetch with get_component.",
|
|
6364
|
+
inputParams: UnpublishComponentToolParams.shape,
|
|
6352
6365
|
annotations: {
|
|
6353
6366
|
readOnlyHint: false,
|
|
6354
6367
|
destructiveHint: true,
|
|
6355
6368
|
idempotentHint: true,
|
|
6356
6369
|
openWorldHint: false
|
|
6357
6370
|
},
|
|
6358
|
-
tool:
|
|
6371
|
+
tool: unpublishComponent
|
|
6359
6372
|
}
|
|
6360
6373
|
};
|
|
6361
6374
|
}
|
|
6362
6375
|
|
|
6363
|
-
// src/tools/exo/fragments/
|
|
6376
|
+
// src/tools/exo/experience-fragments/getExperienceFragment.ts
|
|
6364
6377
|
import { z as z91 } from "zod";
|
|
6365
|
-
var
|
|
6366
|
-
|
|
6378
|
+
var GetExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6379
|
+
experienceFragmentId: z91.string().describe("The ID of the experience fragment to retrieve details for")
|
|
6367
6380
|
});
|
|
6368
|
-
function
|
|
6381
|
+
function getExperienceFragmentTool(config) {
|
|
6369
6382
|
async function tool2(args) {
|
|
6370
6383
|
const contentfulClient = createToolClient(config, args);
|
|
6371
|
-
const
|
|
6384
|
+
const experienceFragment = await contentfulClient.experienceFragment.get({
|
|
6372
6385
|
spaceId: args.spaceId,
|
|
6373
6386
|
environmentId: args.environmentId,
|
|
6374
|
-
|
|
6387
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6375
6388
|
});
|
|
6376
|
-
return createSuccessResponse("
|
|
6377
|
-
|
|
6389
|
+
return createSuccessResponse("Experience fragment retrieved successfully", {
|
|
6390
|
+
experienceFragment
|
|
6378
6391
|
});
|
|
6379
6392
|
}
|
|
6380
|
-
return withErrorHandling(tool2, "Error retrieving fragment");
|
|
6393
|
+
return withErrorHandling(tool2, "Error retrieving experience fragment");
|
|
6381
6394
|
}
|
|
6382
6395
|
|
|
6383
|
-
// src/tools/exo/fragments/
|
|
6396
|
+
// src/tools/exo/experience-fragments/listExperienceFragments.ts
|
|
6384
6397
|
import { z as z92 } from "zod";
|
|
6385
|
-
var
|
|
6386
|
-
limit: z92.number().optional().describe("Maximum number of fragments to return (max 10)"),
|
|
6398
|
+
var ListExperienceFragmentsToolParams = BaseToolSchema.extend({
|
|
6399
|
+
limit: z92.number().optional().describe("Maximum number of experience fragments to return (max 10)"),
|
|
6387
6400
|
pageNext: z92.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
6388
6401
|
pagePrev: z92.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
6389
|
-
order: z92.string().optional().describe("Order fragments by this field (e.g. sys.createdAt)")
|
|
6402
|
+
order: z92.string().optional().describe("Order experience fragments by this field (e.g. sys.createdAt)")
|
|
6390
6403
|
});
|
|
6391
|
-
function
|
|
6404
|
+
function listExperienceFragmentsTool(config) {
|
|
6392
6405
|
async function tool2(args) {
|
|
6393
6406
|
const contentfulClient = createToolClient(config, args);
|
|
6394
|
-
const
|
|
6407
|
+
const experienceFragments = await contentfulClient.experienceFragment.getMany({
|
|
6395
6408
|
spaceId: args.spaceId,
|
|
6396
6409
|
environmentId: args.environmentId,
|
|
6397
6410
|
query: {
|
|
@@ -6401,51 +6414,53 @@ function listFragmentsTool(config) {
|
|
|
6401
6414
|
...args.order && { order: args.order }
|
|
6402
6415
|
}
|
|
6403
6416
|
});
|
|
6404
|
-
const summarized = summarizeData(
|
|
6417
|
+
const summarized = summarizeData(experienceFragments, {
|
|
6405
6418
|
maxItems: 10,
|
|
6406
|
-
remainingMessage: "To see more fragments, ask me to retrieve the next page using the pageNext cursor."
|
|
6419
|
+
remainingMessage: "To see more experience fragments, ask me to retrieve the next page using the pageNext cursor."
|
|
6407
6420
|
});
|
|
6408
|
-
return createSuccessResponse("
|
|
6409
|
-
|
|
6410
|
-
total:
|
|
6411
|
-
limit:
|
|
6412
|
-
pages:
|
|
6421
|
+
return createSuccessResponse("ExperienceFragments retrieved successfully", {
|
|
6422
|
+
experienceFragments: summarized,
|
|
6423
|
+
total: experienceFragments.total,
|
|
6424
|
+
limit: experienceFragments.limit,
|
|
6425
|
+
pages: experienceFragments.pages
|
|
6413
6426
|
});
|
|
6414
6427
|
}
|
|
6415
|
-
return withErrorHandling(tool2, "Error listing fragments");
|
|
6428
|
+
return withErrorHandling(tool2, "Error listing experience fragments");
|
|
6416
6429
|
}
|
|
6417
6430
|
|
|
6418
|
-
// src/tools/exo/fragments/
|
|
6431
|
+
// src/tools/exo/experience-fragments/createExperienceFragment.ts
|
|
6419
6432
|
import { z as z93 } from "zod";
|
|
6420
|
-
var
|
|
6421
|
-
name: z93.string().describe("The name of the fragment"),
|
|
6422
|
-
description: z93.string().describe("Description of the fragment"),
|
|
6423
|
-
|
|
6424
|
-
"Resource link to the component
|
|
6433
|
+
var CreateExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6434
|
+
name: z93.string().describe("The name of the experience fragment"),
|
|
6435
|
+
description: z93.string().describe("Description of the experience fragment"),
|
|
6436
|
+
component: ComponentResourceLinkSchema.describe(
|
|
6437
|
+
"Resource link to the component this experience fragment is based on"
|
|
6425
6438
|
),
|
|
6426
6439
|
viewports: z93.array(ViewportSchema).describe("Viewport definitions (may be empty)"),
|
|
6427
|
-
designProperties: z93.record(z93.string(), DimensionedDesignPropertyValueSchema).describe(
|
|
6440
|
+
designProperties: z93.record(z93.string(), DimensionedDesignPropertyValueSchema).describe(
|
|
6441
|
+
"Design property values keyed by property ID (may be empty object)"
|
|
6442
|
+
),
|
|
6428
6443
|
contentBindings: ExperienceContentBindingsSchema.optional().describe(
|
|
6429
|
-
"Optional content bindings for the fragment"
|
|
6444
|
+
"Optional content bindings for the experience fragment"
|
|
6430
6445
|
),
|
|
6431
6446
|
slots: z93.record(z93.string(), z93.array(ExperienceSlotNodeSchema)).optional().describe("Optional slot node definitions keyed by slot ID"),
|
|
6432
6447
|
metadata: ExperienceMetadataSchema.optional().describe(
|
|
6433
6448
|
"Optional ExO metadata (tags, concepts)"
|
|
6434
6449
|
)
|
|
6435
6450
|
});
|
|
6436
|
-
function
|
|
6451
|
+
function createExperienceFragmentTool(config) {
|
|
6437
6452
|
async function tool2(args) {
|
|
6438
6453
|
assertEnvironmentNotProtected(
|
|
6439
6454
|
args.environmentId,
|
|
6440
6455
|
config.protectedEnvironments
|
|
6441
6456
|
);
|
|
6442
6457
|
const contentfulClient = createToolClient(config, args);
|
|
6443
|
-
const
|
|
6458
|
+
const experienceFragment = await contentfulClient.experienceFragment.create(
|
|
6444
6459
|
{ spaceId: args.spaceId, environmentId: args.environmentId },
|
|
6445
6460
|
{
|
|
6446
6461
|
name: args.name,
|
|
6447
6462
|
description: args.description,
|
|
6448
|
-
|
|
6463
|
+
component: args.component,
|
|
6449
6464
|
viewports: args.viewports,
|
|
6450
6465
|
designProperties: args.designProperties,
|
|
6451
6466
|
...args.contentBindings && { contentBindings: args.contentBindings },
|
|
@@ -6453,22 +6468,22 @@ function createFragmentTool(config) {
|
|
|
6453
6468
|
...args.metadata && { metadata: args.metadata }
|
|
6454
6469
|
}
|
|
6455
6470
|
);
|
|
6456
|
-
return createSuccessResponse("
|
|
6457
|
-
|
|
6471
|
+
return createSuccessResponse("Experience fragment created successfully", {
|
|
6472
|
+
experienceFragment
|
|
6458
6473
|
});
|
|
6459
6474
|
}
|
|
6460
|
-
return withErrorHandling(tool2, "Error creating fragment");
|
|
6475
|
+
return withErrorHandling(tool2, "Error creating experience fragment");
|
|
6461
6476
|
}
|
|
6462
6477
|
|
|
6463
|
-
// src/tools/exo/fragments/
|
|
6478
|
+
// src/tools/exo/experience-fragments/updateExperienceFragment.ts
|
|
6464
6479
|
import { z as z94 } from "zod";
|
|
6465
|
-
var
|
|
6466
|
-
|
|
6480
|
+
var UpdateExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6481
|
+
experienceFragmentId: z94.string().describe("The ID of the experience fragment to update"),
|
|
6467
6482
|
version: z94.number().describe(
|
|
6468
|
-
"REQUIRED. The fragment's sys.version as returned by
|
|
6483
|
+
"REQUIRED. The experience fragment's sys.version as returned by get_experience_fragment. You must call get_experience_fragment first to read the current state and version. The update is rejected if this does not match the current version, which means the experience fragment changed since you read it."
|
|
6469
6484
|
),
|
|
6470
|
-
name: z94.string().optional().describe("The name of the fragment"),
|
|
6471
|
-
description: z94.string().optional().describe("Description of the fragment"),
|
|
6485
|
+
name: z94.string().optional().describe("The name of the experience fragment"),
|
|
6486
|
+
description: z94.string().optional().describe("Description of the experience fragment"),
|
|
6472
6487
|
viewports: z94.array(ViewportSchema).optional().describe("Viewport definitions; replaces existing viewports if provided"),
|
|
6473
6488
|
designProperties: z94.record(z94.string(), DimensionedDesignPropertyValueSchema).optional().describe("Design property values; replaces existing if provided"),
|
|
6474
6489
|
contentBindings: ExperienceContentBindingsSchema.optional().describe(
|
|
@@ -6479,7 +6494,7 @@ var UpdateFragmentToolParams = BaseToolSchema.extend({
|
|
|
6479
6494
|
"ExO metadata (tags, concepts); replaces existing if provided"
|
|
6480
6495
|
)
|
|
6481
6496
|
});
|
|
6482
|
-
function
|
|
6497
|
+
function updateExperienceFragmentTool(config) {
|
|
6483
6498
|
async function tool2(args) {
|
|
6484
6499
|
assertEnvironmentNotProtected(
|
|
6485
6500
|
args.environmentId,
|
|
@@ -6488,40 +6503,43 @@ function updateFragmentTool(config) {
|
|
|
6488
6503
|
const params = {
|
|
6489
6504
|
spaceId: args.spaceId,
|
|
6490
6505
|
environmentId: args.environmentId,
|
|
6491
|
-
|
|
6506
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6492
6507
|
};
|
|
6493
6508
|
const contentfulClient = createToolClient(config, args);
|
|
6494
|
-
const current = await contentfulClient.
|
|
6509
|
+
const current = await contentfulClient.experienceFragment.get(params);
|
|
6495
6510
|
if (args.version !== current.sys.version) {
|
|
6496
6511
|
throw new Error(
|
|
6497
|
-
`Version conflict: the fragment has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the fragment with
|
|
6512
|
+
`Version conflict: the experience fragment has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the experience fragment with get_experience_fragment and retry the update with the latest sys.version.`
|
|
6498
6513
|
);
|
|
6499
6514
|
}
|
|
6500
|
-
const
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6515
|
+
const experienceFragment = await contentfulClient.experienceFragment.upsert(
|
|
6516
|
+
params,
|
|
6517
|
+
{
|
|
6518
|
+
sys: {
|
|
6519
|
+
id: current.sys.id,
|
|
6520
|
+
type: "ExperienceFragment",
|
|
6521
|
+
version: current.sys.version
|
|
6522
|
+
},
|
|
6523
|
+
name: args.name ?? current.name,
|
|
6524
|
+
description: args.description ?? current.description,
|
|
6525
|
+
viewports: args.viewports ?? current.viewports,
|
|
6526
|
+
designProperties: args.designProperties ?? current.designProperties,
|
|
6527
|
+
...args.contentBindings ?? current.contentBindings ? { contentBindings: args.contentBindings ?? current.contentBindings } : {},
|
|
6528
|
+
...args.slots ?? current.slots ? { slots: args.slots ?? current.slots } : {},
|
|
6529
|
+
...args.metadata ?? current.metadata ? { metadata: args.metadata ?? current.metadata } : {}
|
|
6530
|
+
}
|
|
6531
|
+
);
|
|
6532
|
+
return createSuccessResponse("Experience fragment updated successfully", {
|
|
6533
|
+
experienceFragment
|
|
6516
6534
|
});
|
|
6517
6535
|
}
|
|
6518
|
-
return withErrorHandling(tool2, "Error updating fragment");
|
|
6536
|
+
return withErrorHandling(tool2, "Error updating experience fragment");
|
|
6519
6537
|
}
|
|
6520
6538
|
|
|
6521
|
-
// src/tools/exo/fragments/
|
|
6539
|
+
// src/tools/exo/experience-fragments/deleteExperienceFragment.ts
|
|
6522
6540
|
import { z as z95 } from "zod";
|
|
6523
|
-
var
|
|
6524
|
-
|
|
6541
|
+
var DeleteExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6542
|
+
experienceFragmentId: z95.string().describe("The ID of the experience fragment to delete"),
|
|
6525
6543
|
confirm: z95.boolean().optional().describe(
|
|
6526
6544
|
"Set to true on the second call to actually perform the deletion. Required together with confirmToken."
|
|
6527
6545
|
),
|
|
@@ -6529,7 +6547,7 @@ var DeleteFragmentToolParams = BaseToolSchema.extend({
|
|
|
6529
6547
|
"Token returned by the preview call; must be supplied with confirm: true."
|
|
6530
6548
|
)
|
|
6531
6549
|
});
|
|
6532
|
-
function
|
|
6550
|
+
function deleteExperienceFragmentTool(config) {
|
|
6533
6551
|
async function tool2(args) {
|
|
6534
6552
|
assertEnvironmentNotProtected(
|
|
6535
6553
|
args.environmentId,
|
|
@@ -6538,43 +6556,43 @@ function deleteFragmentTool(config) {
|
|
|
6538
6556
|
const params = {
|
|
6539
6557
|
spaceId: args.spaceId,
|
|
6540
6558
|
environmentId: args.environmentId,
|
|
6541
|
-
|
|
6559
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6542
6560
|
};
|
|
6543
6561
|
const contentfulClient = createToolClient(config, args);
|
|
6544
|
-
const
|
|
6562
|
+
const experienceFragment = await contentfulClient.experienceFragment.get(params);
|
|
6545
6563
|
const expectedToken = buildConfirmToken(
|
|
6546
|
-
"
|
|
6547
|
-
args.
|
|
6548
|
-
|
|
6564
|
+
"experienceFragment",
|
|
6565
|
+
args.experienceFragmentId,
|
|
6566
|
+
experienceFragment.sys.version
|
|
6549
6567
|
);
|
|
6550
6568
|
if (args.confirm !== true || args.confirmToken !== expectedToken) {
|
|
6551
6569
|
return createSuccessResponse(
|
|
6552
|
-
`${CONFIRMATION_MESSAGE_PREFIX} fragment`,
|
|
6570
|
+
`${CONFIRMATION_MESSAGE_PREFIX} experience fragment`,
|
|
6553
6571
|
buildConfirmationPreview(
|
|
6554
|
-
"
|
|
6555
|
-
args.
|
|
6556
|
-
{
|
|
6572
|
+
"experienceFragment",
|
|
6573
|
+
args.experienceFragmentId,
|
|
6574
|
+
{ experienceFragment },
|
|
6557
6575
|
expectedToken
|
|
6558
6576
|
)
|
|
6559
6577
|
);
|
|
6560
6578
|
}
|
|
6561
|
-
await contentfulClient.
|
|
6562
|
-
return createSuccessResponse("
|
|
6563
|
-
|
|
6579
|
+
await contentfulClient.experienceFragment.delete(params);
|
|
6580
|
+
return createSuccessResponse("Experience fragment deleted successfully", {
|
|
6581
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6564
6582
|
});
|
|
6565
6583
|
}
|
|
6566
|
-
return withErrorHandling(tool2, "Error deleting fragment");
|
|
6584
|
+
return withErrorHandling(tool2, "Error deleting experience fragment");
|
|
6567
6585
|
}
|
|
6568
6586
|
|
|
6569
|
-
// src/tools/exo/fragments/
|
|
6587
|
+
// src/tools/exo/experience-fragments/publishExperienceFragment.ts
|
|
6570
6588
|
import { z as z96 } from "zod";
|
|
6571
|
-
var
|
|
6572
|
-
|
|
6589
|
+
var PublishExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6590
|
+
experienceFragmentId: z96.string().describe("The ID of the experience fragment to publish"),
|
|
6573
6591
|
version: z96.number().describe(
|
|
6574
|
-
"REQUIRED. The fragment's sys.version as returned by
|
|
6592
|
+
"REQUIRED. The experience fragment's sys.version as returned by get_experience_fragment. You must call get_experience_fragment first to read the current state and version. The publish is rejected if this does not match the current version, which means the experience fragment changed since you read it."
|
|
6575
6593
|
)
|
|
6576
6594
|
});
|
|
6577
|
-
function
|
|
6595
|
+
function publishExperienceFragmentTool(config) {
|
|
6578
6596
|
async function tool2(args) {
|
|
6579
6597
|
assertEnvironmentNotProtected(
|
|
6580
6598
|
args.environmentId,
|
|
@@ -6583,35 +6601,35 @@ function publishFragmentTool(config) {
|
|
|
6583
6601
|
const params = {
|
|
6584
6602
|
spaceId: args.spaceId,
|
|
6585
6603
|
environmentId: args.environmentId,
|
|
6586
|
-
|
|
6604
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6587
6605
|
};
|
|
6588
6606
|
const contentfulClient = createToolClient(config, args);
|
|
6589
|
-
const current = await contentfulClient.
|
|
6607
|
+
const current = await contentfulClient.experienceFragment.get(params);
|
|
6590
6608
|
if (args.version !== current.sys.version) {
|
|
6591
6609
|
throw new Error(
|
|
6592
|
-
`Version conflict: the fragment has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the fragment with
|
|
6610
|
+
`Version conflict: the experience fragment has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the experience fragment with get_experience_fragment and retry with the latest sys.version.`
|
|
6593
6611
|
);
|
|
6594
6612
|
}
|
|
6595
|
-
const
|
|
6613
|
+
const experienceFragment = await contentfulClient.experienceFragment.publish({
|
|
6596
6614
|
...params,
|
|
6597
6615
|
version: args.version
|
|
6598
6616
|
});
|
|
6599
|
-
return createSuccessResponse("
|
|
6600
|
-
|
|
6617
|
+
return createSuccessResponse("Experience fragment published successfully", {
|
|
6618
|
+
experienceFragment
|
|
6601
6619
|
});
|
|
6602
6620
|
}
|
|
6603
|
-
return withErrorHandling(tool2, "Error publishing fragment");
|
|
6621
|
+
return withErrorHandling(tool2, "Error publishing experience fragment");
|
|
6604
6622
|
}
|
|
6605
6623
|
|
|
6606
|
-
// src/tools/exo/fragments/
|
|
6624
|
+
// src/tools/exo/experience-fragments/unpublishExperienceFragment.ts
|
|
6607
6625
|
import { z as z97 } from "zod";
|
|
6608
|
-
var
|
|
6609
|
-
|
|
6626
|
+
var UnpublishExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6627
|
+
experienceFragmentId: z97.string().describe("The ID of the experience fragment to unpublish"),
|
|
6610
6628
|
version: z97.number().describe(
|
|
6611
|
-
"REQUIRED. The fragment's sys.version as returned by
|
|
6629
|
+
"REQUIRED. The experience fragment's sys.version as returned by get_experience_fragment. You must call get_experience_fragment first to read the current state and version. The unpublish is rejected if this does not match the current version, which means the experience fragment changed since you read it."
|
|
6612
6630
|
)
|
|
6613
6631
|
});
|
|
6614
|
-
function
|
|
6632
|
+
function unpublishExperienceFragmentTool(config) {
|
|
6615
6633
|
async function tool2(args) {
|
|
6616
6634
|
assertEnvironmentNotProtected(
|
|
6617
6635
|
args.environmentId,
|
|
@@ -6620,153 +6638,156 @@ function unpublishFragmentTool(config) {
|
|
|
6620
6638
|
const params = {
|
|
6621
6639
|
spaceId: args.spaceId,
|
|
6622
6640
|
environmentId: args.environmentId,
|
|
6623
|
-
|
|
6641
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6624
6642
|
};
|
|
6625
6643
|
const contentfulClient = createToolClient(config, args);
|
|
6626
|
-
const current = await contentfulClient.
|
|
6644
|
+
const current = await contentfulClient.experienceFragment.get(params);
|
|
6627
6645
|
if (args.version !== current.sys.version) {
|
|
6628
6646
|
throw new Error(
|
|
6629
|
-
`Version conflict: the fragment has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the fragment with
|
|
6647
|
+
`Version conflict: the experience fragment has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the experience fragment with get_experience_fragment and retry with the latest sys.version.`
|
|
6630
6648
|
);
|
|
6631
6649
|
}
|
|
6632
|
-
const
|
|
6650
|
+
const experienceFragment = await contentfulClient.experienceFragment.unpublish({
|
|
6633
6651
|
...params,
|
|
6634
6652
|
version: args.version
|
|
6635
6653
|
});
|
|
6636
|
-
return createSuccessResponse(
|
|
6637
|
-
fragment
|
|
6638
|
-
|
|
6654
|
+
return createSuccessResponse(
|
|
6655
|
+
"Experience fragment unpublished successfully",
|
|
6656
|
+
{
|
|
6657
|
+
experienceFragment
|
|
6658
|
+
}
|
|
6659
|
+
);
|
|
6639
6660
|
}
|
|
6640
|
-
return withErrorHandling(tool2, "Error unpublishing fragment");
|
|
6661
|
+
return withErrorHandling(tool2, "Error unpublishing experience fragment");
|
|
6641
6662
|
}
|
|
6642
6663
|
|
|
6643
|
-
// src/tools/exo/fragments/register.ts
|
|
6644
|
-
function
|
|
6645
|
-
const
|
|
6646
|
-
const
|
|
6647
|
-
const
|
|
6648
|
-
const
|
|
6649
|
-
const
|
|
6650
|
-
const
|
|
6651
|
-
const
|
|
6664
|
+
// src/tools/exo/experience-fragments/register.ts
|
|
6665
|
+
function createExperienceFragmentTools(config) {
|
|
6666
|
+
const getExperienceFragment = getExperienceFragmentTool(config);
|
|
6667
|
+
const listExperienceFragments = listExperienceFragmentsTool(config);
|
|
6668
|
+
const createExperienceFragment = createExperienceFragmentTool(config);
|
|
6669
|
+
const updateExperienceFragment = updateExperienceFragmentTool(config);
|
|
6670
|
+
const deleteExperienceFragment = deleteExperienceFragmentTool(config);
|
|
6671
|
+
const publishExperienceFragment = publishExperienceFragmentTool(config);
|
|
6672
|
+
const unpublishExperienceFragment = unpublishExperienceFragmentTool(config);
|
|
6652
6673
|
return {
|
|
6653
|
-
|
|
6654
|
-
title: "
|
|
6655
|
-
description: "Get details about a specific ExO fragment (a reusable content unit that can be referenced across multiple Experiences and
|
|
6656
|
-
inputParams:
|
|
6674
|
+
getExperienceFragment: {
|
|
6675
|
+
title: "get_experience_fragment",
|
|
6676
|
+
description: "Get details about a specific ExO experience fragment (a reusable content unit that can be referenced across multiple Experiences and Components).",
|
|
6677
|
+
inputParams: GetExperienceFragmentToolParams.shape,
|
|
6657
6678
|
annotations: {
|
|
6658
6679
|
readOnlyHint: true,
|
|
6659
6680
|
destructiveHint: false,
|
|
6660
6681
|
openWorldHint: false
|
|
6661
6682
|
},
|
|
6662
|
-
tool:
|
|
6683
|
+
tool: getExperienceFragment
|
|
6663
6684
|
},
|
|
6664
|
-
|
|
6665
|
-
title: "
|
|
6666
|
-
description: "List ExO fragments in a space and environment. Returns a maximum of 10 items per request; use the pageNext cursor (returned in pages.next) to paginate.",
|
|
6667
|
-
inputParams:
|
|
6685
|
+
listExperienceFragments: {
|
|
6686
|
+
title: "list_experience_fragments",
|
|
6687
|
+
description: "List ExO experience fragments in a space and environment. Returns a maximum of 10 items per request; use the pageNext cursor (returned in pages.next) to paginate.",
|
|
6688
|
+
inputParams: ListExperienceFragmentsToolParams.shape,
|
|
6668
6689
|
annotations: {
|
|
6669
6690
|
readOnlyHint: true,
|
|
6670
6691
|
destructiveHint: false,
|
|
6671
6692
|
openWorldHint: false
|
|
6672
6693
|
},
|
|
6673
|
-
tool:
|
|
6694
|
+
tool: listExperienceFragments
|
|
6674
6695
|
},
|
|
6675
|
-
|
|
6676
|
-
title: "
|
|
6677
|
-
description: "Create a new ExO fragment.",
|
|
6678
|
-
inputParams:
|
|
6696
|
+
createExperienceFragment: {
|
|
6697
|
+
title: "create_experience_fragment",
|
|
6698
|
+
description: "Create a new ExO experience fragment.",
|
|
6699
|
+
inputParams: CreateExperienceFragmentToolParams.shape,
|
|
6679
6700
|
annotations: {
|
|
6680
6701
|
readOnlyHint: false,
|
|
6681
6702
|
destructiveHint: false,
|
|
6682
6703
|
idempotentHint: false,
|
|
6683
6704
|
openWorldHint: false
|
|
6684
6705
|
},
|
|
6685
|
-
tool:
|
|
6706
|
+
tool: createExperienceFragment
|
|
6686
6707
|
},
|
|
6687
|
-
|
|
6688
|
-
title: "
|
|
6689
|
-
description: "Update an existing ExO fragment. You MUST call
|
|
6690
|
-
inputParams:
|
|
6708
|
+
updateExperienceFragment: {
|
|
6709
|
+
title: "update_experience_fragment",
|
|
6710
|
+
description: "Update an existing ExO experience fragment. You MUST call get_experience_fragment first to read the current state, then pass the sys.version you received as the version parameter. The handler merges your updates with the existing experience fragment fields, so you only need to provide the fields you want to change. If the version is stale (the experience fragment changed since you read it), the update is rejected and you must re-fetch with get_experience_fragment.",
|
|
6711
|
+
inputParams: UpdateExperienceFragmentToolParams.shape,
|
|
6691
6712
|
annotations: {
|
|
6692
6713
|
readOnlyHint: false,
|
|
6693
6714
|
destructiveHint: false,
|
|
6694
6715
|
idempotentHint: false,
|
|
6695
6716
|
openWorldHint: false
|
|
6696
6717
|
},
|
|
6697
|
-
tool:
|
|
6718
|
+
tool: updateExperienceFragment
|
|
6698
6719
|
},
|
|
6699
|
-
|
|
6700
|
-
title: "
|
|
6701
|
-
description: "Delete an ExO fragment. Two-phase: the first call (without confirm/confirmToken) returns a preview and a confirmToken. To complete the deletion, call again with the same
|
|
6702
|
-
inputParams:
|
|
6720
|
+
deleteExperienceFragment: {
|
|
6721
|
+
title: "delete_experience_fragment",
|
|
6722
|
+
description: "Delete an ExO experience fragment. Two-phase: the first call (without confirm/confirmToken) returns a preview and a confirmToken. To complete the deletion, call again with the same experienceFragmentId, confirm: true, and the confirmToken from the preview.",
|
|
6723
|
+
inputParams: DeleteExperienceFragmentToolParams.shape,
|
|
6703
6724
|
annotations: {
|
|
6704
6725
|
readOnlyHint: false,
|
|
6705
6726
|
destructiveHint: true,
|
|
6706
6727
|
idempotentHint: false,
|
|
6707
6728
|
openWorldHint: false
|
|
6708
6729
|
},
|
|
6709
|
-
tool:
|
|
6730
|
+
tool: deleteExperienceFragment
|
|
6710
6731
|
},
|
|
6711
|
-
|
|
6712
|
-
title: "
|
|
6713
|
-
description: "Publish an ExO fragment. You MUST call
|
|
6714
|
-
inputParams:
|
|
6732
|
+
publishExperienceFragment: {
|
|
6733
|
+
title: "publish_experience_fragment",
|
|
6734
|
+
description: "Publish an ExO experience fragment. You MUST call get_experience_fragment first and pass the returned sys.version as the version parameter. If the version is stale the operation is rejected and you must re-fetch with get_experience_fragment.",
|
|
6735
|
+
inputParams: PublishExperienceFragmentToolParams.shape,
|
|
6715
6736
|
annotations: {
|
|
6716
6737
|
readOnlyHint: false,
|
|
6717
6738
|
destructiveHint: true,
|
|
6718
6739
|
idempotentHint: true,
|
|
6719
6740
|
openWorldHint: false
|
|
6720
6741
|
},
|
|
6721
|
-
tool:
|
|
6742
|
+
tool: publishExperienceFragment
|
|
6722
6743
|
},
|
|
6723
|
-
|
|
6724
|
-
title: "
|
|
6725
|
-
description: "Unpublish an ExO fragment. You MUST call
|
|
6726
|
-
inputParams:
|
|
6744
|
+
unpublishExperienceFragment: {
|
|
6745
|
+
title: "unpublish_experience_fragment",
|
|
6746
|
+
description: "Unpublish an ExO experience fragment. You MUST call get_experience_fragment first and pass the returned sys.version as the version parameter. If the version is stale the operation is rejected and you must re-fetch with get_experience_fragment.",
|
|
6747
|
+
inputParams: UnpublishExperienceFragmentToolParams.shape,
|
|
6727
6748
|
annotations: {
|
|
6728
6749
|
readOnlyHint: false,
|
|
6729
6750
|
destructiveHint: true,
|
|
6730
6751
|
idempotentHint: true,
|
|
6731
6752
|
openWorldHint: false
|
|
6732
6753
|
},
|
|
6733
|
-
tool:
|
|
6754
|
+
tool: unpublishExperienceFragment
|
|
6734
6755
|
}
|
|
6735
6756
|
};
|
|
6736
6757
|
}
|
|
6737
6758
|
|
|
6738
|
-
// src/tools/exo/templates/
|
|
6759
|
+
// src/tools/exo/experience-templates/getExperienceTemplate.ts
|
|
6739
6760
|
import { z as z98 } from "zod";
|
|
6740
|
-
var
|
|
6741
|
-
|
|
6761
|
+
var GetExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
6762
|
+
experienceTemplateId: z98.string().describe("The ID of the experience template to retrieve details for")
|
|
6742
6763
|
});
|
|
6743
|
-
function
|
|
6764
|
+
function getExperienceTemplateTool(config) {
|
|
6744
6765
|
async function tool2(args) {
|
|
6745
6766
|
const contentfulClient = createToolClient(config, args);
|
|
6746
|
-
const
|
|
6767
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.get({
|
|
6747
6768
|
spaceId: args.spaceId,
|
|
6748
6769
|
environmentId: args.environmentId,
|
|
6749
|
-
|
|
6770
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6750
6771
|
});
|
|
6751
|
-
return createSuccessResponse("
|
|
6752
|
-
|
|
6772
|
+
return createSuccessResponse("Experience template retrieved successfully", {
|
|
6773
|
+
experienceTemplate
|
|
6753
6774
|
});
|
|
6754
6775
|
}
|
|
6755
|
-
return withErrorHandling(tool2, "Error retrieving template");
|
|
6776
|
+
return withErrorHandling(tool2, "Error retrieving experience template");
|
|
6756
6777
|
}
|
|
6757
6778
|
|
|
6758
|
-
// src/tools/exo/templates/
|
|
6779
|
+
// src/tools/exo/experience-templates/listExperienceTemplates.ts
|
|
6759
6780
|
import { z as z99 } from "zod";
|
|
6760
|
-
var
|
|
6761
|
-
limit: z99.number().optional().describe("Maximum number of templates to return (max 10)"),
|
|
6781
|
+
var ListExperienceTemplatesToolParams = BaseToolSchema.extend({
|
|
6782
|
+
limit: z99.number().optional().describe("Maximum number of experience templates to return (max 10)"),
|
|
6762
6783
|
pageNext: z99.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
6763
6784
|
pagePrev: z99.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
6764
|
-
order: z99.string().optional().describe("Order templates by this field (e.g. sys.createdAt)")
|
|
6785
|
+
order: z99.string().optional().describe("Order experience templates by this field (e.g. sys.createdAt)")
|
|
6765
6786
|
});
|
|
6766
|
-
function
|
|
6787
|
+
function listExperienceTemplatesTool(config) {
|
|
6767
6788
|
async function tool2(args) {
|
|
6768
6789
|
const contentfulClient = createToolClient(config, args);
|
|
6769
|
-
const
|
|
6790
|
+
const experienceTemplates = await contentfulClient.experienceTemplate.getMany({
|
|
6770
6791
|
spaceId: args.spaceId,
|
|
6771
6792
|
environmentId: args.environmentId,
|
|
6772
6793
|
query: {
|
|
@@ -6776,26 +6797,28 @@ function listTemplatesTool(config) {
|
|
|
6776
6797
|
...args.order && { order: args.order }
|
|
6777
6798
|
}
|
|
6778
6799
|
});
|
|
6779
|
-
const summarized = summarizeData(
|
|
6800
|
+
const summarized = summarizeData(experienceTemplates, {
|
|
6780
6801
|
maxItems: 10,
|
|
6781
|
-
remainingMessage: "To see more templates, ask me to retrieve the next page using the pageNext cursor."
|
|
6802
|
+
remainingMessage: "To see more experience templates, ask me to retrieve the next page using the pageNext cursor."
|
|
6782
6803
|
});
|
|
6783
|
-
return createSuccessResponse("
|
|
6784
|
-
|
|
6785
|
-
total:
|
|
6786
|
-
limit:
|
|
6787
|
-
pages:
|
|
6804
|
+
return createSuccessResponse("ExperienceTemplates retrieved successfully", {
|
|
6805
|
+
experienceTemplates: summarized,
|
|
6806
|
+
total: experienceTemplates.total,
|
|
6807
|
+
limit: experienceTemplates.limit,
|
|
6808
|
+
pages: experienceTemplates.pages
|
|
6788
6809
|
});
|
|
6789
6810
|
}
|
|
6790
|
-
return withErrorHandling(tool2, "Error listing templates");
|
|
6811
|
+
return withErrorHandling(tool2, "Error listing experience templates");
|
|
6791
6812
|
}
|
|
6792
6813
|
|
|
6793
|
-
// src/tools/exo/templates/
|
|
6814
|
+
// src/tools/exo/experience-templates/createExperienceTemplate.ts
|
|
6794
6815
|
import { z as z100 } from "zod";
|
|
6795
|
-
var
|
|
6796
|
-
name: z100.string().describe("The name of the template"),
|
|
6797
|
-
description: z100.string().describe("Description of the template"),
|
|
6798
|
-
viewports: z100.array(ViewportSchema).describe(
|
|
6816
|
+
var CreateExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
6817
|
+
name: z100.string().describe("The name of the experience template"),
|
|
6818
|
+
description: z100.string().describe("Description of the experience template"),
|
|
6819
|
+
viewports: z100.array(ViewportSchema).describe(
|
|
6820
|
+
"Viewport definitions for the experience template (may be empty)"
|
|
6821
|
+
),
|
|
6799
6822
|
contentProperties: z100.array(ContentPropertySchema).describe("Content property definitions (may be empty)"),
|
|
6800
6823
|
designProperties: z100.array(DesignPropertySchema).describe("Design property definitions (may be empty)"),
|
|
6801
6824
|
componentTree: z100.array(TreeNodeSchema).optional().describe("Optional component tree node definitions"),
|
|
@@ -6804,14 +6827,14 @@ var CreateTemplateToolParams = BaseToolSchema.extend({
|
|
|
6804
6827
|
"Optional ExO metadata (tags, concepts)"
|
|
6805
6828
|
)
|
|
6806
6829
|
});
|
|
6807
|
-
function
|
|
6830
|
+
function createExperienceTemplateTool(config) {
|
|
6808
6831
|
async function tool2(args) {
|
|
6809
6832
|
assertEnvironmentNotProtected(
|
|
6810
6833
|
args.environmentId,
|
|
6811
6834
|
config.protectedEnvironments
|
|
6812
6835
|
);
|
|
6813
6836
|
const contentfulClient = createToolClient(config, args);
|
|
6814
|
-
const
|
|
6837
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.create(
|
|
6815
6838
|
{ spaceId: args.spaceId, environmentId: args.environmentId },
|
|
6816
6839
|
{
|
|
6817
6840
|
name: args.name,
|
|
@@ -6824,22 +6847,22 @@ function createTemplateTool(config) {
|
|
|
6824
6847
|
...args.metadata && { metadata: args.metadata }
|
|
6825
6848
|
}
|
|
6826
6849
|
);
|
|
6827
|
-
return createSuccessResponse("
|
|
6828
|
-
|
|
6850
|
+
return createSuccessResponse("Experience template created successfully", {
|
|
6851
|
+
experienceTemplate
|
|
6829
6852
|
});
|
|
6830
6853
|
}
|
|
6831
|
-
return withErrorHandling(tool2, "Error creating template");
|
|
6854
|
+
return withErrorHandling(tool2, "Error creating experience template");
|
|
6832
6855
|
}
|
|
6833
6856
|
|
|
6834
|
-
// src/tools/exo/templates/
|
|
6857
|
+
// src/tools/exo/experience-templates/upsertExperienceTemplate.ts
|
|
6835
6858
|
import { z as z101 } from "zod";
|
|
6836
|
-
var
|
|
6837
|
-
|
|
6859
|
+
var UpsertExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
6860
|
+
experienceTemplateId: z101.string().describe("The ID of the experience template to update"),
|
|
6838
6861
|
version: z101.number().describe(
|
|
6839
|
-
"REQUIRED. The template's sys.version as returned by
|
|
6862
|
+
"REQUIRED. The experience template's sys.version as returned by get_experience_template. You must call get_experience_template first to read the current state and version. The update is rejected if this does not match the current version, which means the experience template changed since you read it."
|
|
6840
6863
|
),
|
|
6841
|
-
name: z101.string().optional().describe("The name of the template"),
|
|
6842
|
-
description: z101.string().optional().describe("Description of the template"),
|
|
6864
|
+
name: z101.string().optional().describe("The name of the experience template"),
|
|
6865
|
+
description: z101.string().optional().describe("Description of the experience template"),
|
|
6843
6866
|
viewports: z101.array(ViewportSchema).optional().describe("Viewport definitions; replaces existing viewports if provided"),
|
|
6844
6867
|
contentProperties: z101.array(ContentPropertySchema).optional().describe("Content property definitions; replaces existing if provided"),
|
|
6845
6868
|
designProperties: z101.array(DesignPropertySchema).optional().describe("Design property definitions; replaces existing if provided"),
|
|
@@ -6849,7 +6872,7 @@ var UpsertTemplateToolParams = BaseToolSchema.extend({
|
|
|
6849
6872
|
"ExO metadata (tags, concepts); replaces existing if provided"
|
|
6850
6873
|
)
|
|
6851
6874
|
});
|
|
6852
|
-
function
|
|
6875
|
+
function upsertExperienceTemplateTool(config) {
|
|
6853
6876
|
async function tool2(args) {
|
|
6854
6877
|
assertEnvironmentNotProtected(
|
|
6855
6878
|
args.environmentId,
|
|
@@ -6858,42 +6881,45 @@ function upsertTemplateTool(config) {
|
|
|
6858
6881
|
const params = {
|
|
6859
6882
|
spaceId: args.spaceId,
|
|
6860
6883
|
environmentId: args.environmentId,
|
|
6861
|
-
|
|
6884
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6862
6885
|
};
|
|
6863
6886
|
const contentfulClient = createToolClient(config, args);
|
|
6864
|
-
const current = await contentfulClient.
|
|
6887
|
+
const current = await contentfulClient.experienceTemplate.get(params);
|
|
6865
6888
|
if (args.version !== current.sys.version) {
|
|
6866
6889
|
throw new Error(
|
|
6867
|
-
`Version conflict: the template has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the template with
|
|
6890
|
+
`Version conflict: the experience template has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the experience template with get_experience_template and retry the update with the latest sys.version.`
|
|
6868
6891
|
);
|
|
6869
6892
|
}
|
|
6870
|
-
const
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6893
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.upsert(
|
|
6894
|
+
params,
|
|
6895
|
+
{
|
|
6896
|
+
sys: {
|
|
6897
|
+
id: current.sys.id,
|
|
6898
|
+
type: "ExperienceTemplate",
|
|
6899
|
+
version: current.sys.version
|
|
6900
|
+
},
|
|
6901
|
+
name: args.name ?? current.name,
|
|
6902
|
+
description: args.description ?? current.description,
|
|
6903
|
+
viewports: args.viewports ?? current.viewports,
|
|
6904
|
+
contentProperties: args.contentProperties ?? current.contentProperties,
|
|
6905
|
+
designProperties: args.designProperties ?? current.designProperties,
|
|
6906
|
+
...args.componentTree ?? current.componentTree ? { componentTree: args.componentTree ?? current.componentTree } : {},
|
|
6907
|
+
...args.slots ?? current.slots ? { slots: args.slots ?? current.slots } : {},
|
|
6908
|
+
...args.metadata ?? current.metadata ? { metadata: args.metadata ?? current.metadata } : {},
|
|
6909
|
+
...current.dataAssemblies ? { dataAssemblies: current.dataAssemblies } : {}
|
|
6910
|
+
}
|
|
6911
|
+
);
|
|
6912
|
+
return createSuccessResponse("Experience template updated successfully", {
|
|
6913
|
+
experienceTemplate
|
|
6888
6914
|
});
|
|
6889
6915
|
}
|
|
6890
|
-
return withErrorHandling(tool2, "Error updating template");
|
|
6916
|
+
return withErrorHandling(tool2, "Error updating experience template");
|
|
6891
6917
|
}
|
|
6892
6918
|
|
|
6893
|
-
// src/tools/exo/templates/
|
|
6919
|
+
// src/tools/exo/experience-templates/deleteExperienceTemplate.ts
|
|
6894
6920
|
import { z as z102 } from "zod";
|
|
6895
|
-
var
|
|
6896
|
-
|
|
6921
|
+
var DeleteExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
6922
|
+
experienceTemplateId: z102.string().describe("The ID of the experience template to delete"),
|
|
6897
6923
|
confirm: z102.boolean().optional().describe(
|
|
6898
6924
|
"Set to true on the second call to actually perform the deletion. Required together with confirmToken."
|
|
6899
6925
|
),
|
|
@@ -6901,7 +6927,7 @@ var DeleteTemplateToolParams = BaseToolSchema.extend({
|
|
|
6901
6927
|
"Token returned by the preview call; must be supplied with confirm: true."
|
|
6902
6928
|
)
|
|
6903
6929
|
});
|
|
6904
|
-
function
|
|
6930
|
+
function deleteExperienceTemplateTool(config) {
|
|
6905
6931
|
async function tool2(args) {
|
|
6906
6932
|
assertEnvironmentNotProtected(
|
|
6907
6933
|
args.environmentId,
|
|
@@ -6910,43 +6936,43 @@ function deleteTemplateTool(config) {
|
|
|
6910
6936
|
const params = {
|
|
6911
6937
|
spaceId: args.spaceId,
|
|
6912
6938
|
environmentId: args.environmentId,
|
|
6913
|
-
|
|
6939
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6914
6940
|
};
|
|
6915
6941
|
const contentfulClient = createToolClient(config, args);
|
|
6916
|
-
const
|
|
6942
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.get(params);
|
|
6917
6943
|
const expectedToken = buildConfirmToken(
|
|
6918
|
-
"
|
|
6919
|
-
args.
|
|
6920
|
-
|
|
6944
|
+
"experienceTemplate",
|
|
6945
|
+
args.experienceTemplateId,
|
|
6946
|
+
experienceTemplate.sys.version
|
|
6921
6947
|
);
|
|
6922
6948
|
if (args.confirm !== true || args.confirmToken !== expectedToken) {
|
|
6923
6949
|
return createSuccessResponse(
|
|
6924
|
-
`${CONFIRMATION_MESSAGE_PREFIX} template`,
|
|
6950
|
+
`${CONFIRMATION_MESSAGE_PREFIX} experience template`,
|
|
6925
6951
|
buildConfirmationPreview(
|
|
6926
|
-
"
|
|
6927
|
-
args.
|
|
6928
|
-
{
|
|
6952
|
+
"experienceTemplate",
|
|
6953
|
+
args.experienceTemplateId,
|
|
6954
|
+
{ experienceTemplate },
|
|
6929
6955
|
expectedToken
|
|
6930
6956
|
)
|
|
6931
6957
|
);
|
|
6932
6958
|
}
|
|
6933
|
-
await contentfulClient.
|
|
6934
|
-
return createSuccessResponse("
|
|
6935
|
-
|
|
6959
|
+
await contentfulClient.experienceTemplate.delete(params);
|
|
6960
|
+
return createSuccessResponse("Experience template deleted successfully", {
|
|
6961
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6936
6962
|
});
|
|
6937
6963
|
}
|
|
6938
|
-
return withErrorHandling(tool2, "Error deleting template");
|
|
6964
|
+
return withErrorHandling(tool2, "Error deleting experience template");
|
|
6939
6965
|
}
|
|
6940
6966
|
|
|
6941
|
-
// src/tools/exo/templates/
|
|
6967
|
+
// src/tools/exo/experience-templates/publishExperienceTemplate.ts
|
|
6942
6968
|
import { z as z103 } from "zod";
|
|
6943
|
-
var
|
|
6944
|
-
|
|
6969
|
+
var PublishExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
6970
|
+
experienceTemplateId: z103.string().describe("The ID of the experience template to publish"),
|
|
6945
6971
|
version: z103.number().describe(
|
|
6946
|
-
"REQUIRED. The template's sys.version as returned by
|
|
6972
|
+
"REQUIRED. The experience template's sys.version as returned by get_experience_template. You must call get_experience_template first to read the current state and version. The publish is rejected if this does not match the current version, which means the experience template changed since you read it."
|
|
6947
6973
|
)
|
|
6948
6974
|
});
|
|
6949
|
-
function
|
|
6975
|
+
function publishExperienceTemplateTool(config) {
|
|
6950
6976
|
async function tool2(args) {
|
|
6951
6977
|
assertEnvironmentNotProtected(
|
|
6952
6978
|
args.environmentId,
|
|
@@ -6955,35 +6981,35 @@ function publishTemplateTool(config) {
|
|
|
6955
6981
|
const params = {
|
|
6956
6982
|
spaceId: args.spaceId,
|
|
6957
6983
|
environmentId: args.environmentId,
|
|
6958
|
-
|
|
6984
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6959
6985
|
};
|
|
6960
6986
|
const contentfulClient = createToolClient(config, args);
|
|
6961
|
-
const current = await contentfulClient.
|
|
6987
|
+
const current = await contentfulClient.experienceTemplate.get(params);
|
|
6962
6988
|
if (args.version !== current.sys.version) {
|
|
6963
6989
|
throw new Error(
|
|
6964
|
-
`Version conflict: the template has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the template with
|
|
6990
|
+
`Version conflict: the experience template has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the experience template with get_experience_template and retry with the latest sys.version.`
|
|
6965
6991
|
);
|
|
6966
6992
|
}
|
|
6967
|
-
const
|
|
6993
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.publish({
|
|
6968
6994
|
...params,
|
|
6969
6995
|
version: args.version
|
|
6970
6996
|
});
|
|
6971
|
-
return createSuccessResponse("
|
|
6972
|
-
|
|
6997
|
+
return createSuccessResponse("Experience template published successfully", {
|
|
6998
|
+
experienceTemplate
|
|
6973
6999
|
});
|
|
6974
7000
|
}
|
|
6975
|
-
return withErrorHandling(tool2, "Error publishing template");
|
|
7001
|
+
return withErrorHandling(tool2, "Error publishing experience template");
|
|
6976
7002
|
}
|
|
6977
7003
|
|
|
6978
|
-
// src/tools/exo/templates/
|
|
7004
|
+
// src/tools/exo/experience-templates/unpublishExperienceTemplate.ts
|
|
6979
7005
|
import { z as z104 } from "zod";
|
|
6980
|
-
var
|
|
6981
|
-
|
|
7006
|
+
var UnpublishExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
7007
|
+
experienceTemplateId: z104.string().describe("The ID of the experience template to unpublish"),
|
|
6982
7008
|
version: z104.number().describe(
|
|
6983
|
-
"REQUIRED. The template's sys.version as returned by
|
|
7009
|
+
"REQUIRED. The experience template's sys.version as returned by get_experience_template. You must call get_experience_template first to read the current state and version. The unpublish is rejected if this does not match the current version, which means the experience template changed since you read it."
|
|
6984
7010
|
)
|
|
6985
7011
|
});
|
|
6986
|
-
function
|
|
7012
|
+
function unpublishExperienceTemplateTool(config) {
|
|
6987
7013
|
async function tool2(args) {
|
|
6988
7014
|
assertEnvironmentNotProtected(
|
|
6989
7015
|
args.environmentId,
|
|
@@ -6992,117 +7018,120 @@ function unpublishTemplateTool(config) {
|
|
|
6992
7018
|
const params = {
|
|
6993
7019
|
spaceId: args.spaceId,
|
|
6994
7020
|
environmentId: args.environmentId,
|
|
6995
|
-
|
|
7021
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6996
7022
|
};
|
|
6997
7023
|
const contentfulClient = createToolClient(config, args);
|
|
6998
|
-
const current = await contentfulClient.
|
|
7024
|
+
const current = await contentfulClient.experienceTemplate.get(params);
|
|
6999
7025
|
if (args.version !== current.sys.version) {
|
|
7000
7026
|
throw new Error(
|
|
7001
|
-
`Version conflict: the template has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the template with
|
|
7027
|
+
`Version conflict: the experience template has changed since you read it (your version: ${args.version}, current version: ${current.sys.version}). Re-fetch the experience template with get_experience_template and retry with the latest sys.version.`
|
|
7002
7028
|
);
|
|
7003
7029
|
}
|
|
7004
|
-
const
|
|
7030
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.unpublish({
|
|
7005
7031
|
...params,
|
|
7006
7032
|
version: args.version
|
|
7007
7033
|
});
|
|
7008
|
-
return createSuccessResponse(
|
|
7009
|
-
template
|
|
7010
|
-
|
|
7034
|
+
return createSuccessResponse(
|
|
7035
|
+
"Experience template unpublished successfully",
|
|
7036
|
+
{
|
|
7037
|
+
experienceTemplate
|
|
7038
|
+
}
|
|
7039
|
+
);
|
|
7011
7040
|
}
|
|
7012
|
-
return withErrorHandling(tool2, "Error unpublishing template");
|
|
7041
|
+
return withErrorHandling(tool2, "Error unpublishing experience template");
|
|
7013
7042
|
}
|
|
7014
7043
|
|
|
7015
|
-
// src/tools/exo/templates/register.ts
|
|
7016
|
-
function
|
|
7017
|
-
const
|
|
7018
|
-
const
|
|
7019
|
-
const
|
|
7020
|
-
const
|
|
7021
|
-
const
|
|
7022
|
-
const
|
|
7023
|
-
const
|
|
7044
|
+
// src/tools/exo/experience-templates/register.ts
|
|
7045
|
+
function createExperienceTemplateTools(config) {
|
|
7046
|
+
const getExperienceTemplate = getExperienceTemplateTool(config);
|
|
7047
|
+
const listExperienceTemplates = listExperienceTemplatesTool(config);
|
|
7048
|
+
const createExperienceTemplate = createExperienceTemplateTool(config);
|
|
7049
|
+
const upsertExperienceTemplate = upsertExperienceTemplateTool(config);
|
|
7050
|
+
const deleteExperienceTemplate = deleteExperienceTemplateTool(config);
|
|
7051
|
+
const publishExperienceTemplate = publishExperienceTemplateTool(config);
|
|
7052
|
+
const unpublishExperienceTemplate = unpublishExperienceTemplateTool(config);
|
|
7024
7053
|
return {
|
|
7025
|
-
|
|
7026
|
-
title: "
|
|
7027
|
-
description: "Get details about a specific ExO template (a layout definition that backs template-based Experiences).",
|
|
7028
|
-
inputParams:
|
|
7054
|
+
getExperienceTemplate: {
|
|
7055
|
+
title: "get_experience_template",
|
|
7056
|
+
description: "Get details about a specific ExO experience template (a layout definition that backs experience-template-based Experiences).",
|
|
7057
|
+
inputParams: GetExperienceTemplateToolParams.shape,
|
|
7029
7058
|
annotations: {
|
|
7030
7059
|
readOnlyHint: true,
|
|
7031
7060
|
destructiveHint: false,
|
|
7032
7061
|
openWorldHint: false
|
|
7033
7062
|
},
|
|
7034
|
-
tool:
|
|
7063
|
+
tool: getExperienceTemplate
|
|
7035
7064
|
},
|
|
7036
|
-
|
|
7037
|
-
title: "
|
|
7038
|
-
description: "List ExO templates in a space and environment. Returns a maximum of 10 items per request; use the pageNext cursor (returned in pages.next) to paginate.",
|
|
7039
|
-
inputParams:
|
|
7065
|
+
listExperienceTemplates: {
|
|
7066
|
+
title: "list_experience_templates",
|
|
7067
|
+
description: "List ExO experience templates in a space and environment. Returns a maximum of 10 items per request; use the pageNext cursor (returned in pages.next) to paginate.",
|
|
7068
|
+
inputParams: ListExperienceTemplatesToolParams.shape,
|
|
7040
7069
|
annotations: {
|
|
7041
7070
|
readOnlyHint: true,
|
|
7042
7071
|
destructiveHint: false,
|
|
7043
7072
|
openWorldHint: false
|
|
7044
7073
|
},
|
|
7045
|
-
tool:
|
|
7074
|
+
tool: listExperienceTemplates
|
|
7046
7075
|
},
|
|
7047
|
-
|
|
7048
|
-
title: "
|
|
7049
|
-
description: "Create a new ExO template.",
|
|
7050
|
-
inputParams:
|
|
7076
|
+
createExperienceTemplate: {
|
|
7077
|
+
title: "create_experience_template",
|
|
7078
|
+
description: "Create a new ExO experience template.",
|
|
7079
|
+
inputParams: CreateExperienceTemplateToolParams.shape,
|
|
7051
7080
|
annotations: {
|
|
7052
7081
|
readOnlyHint: false,
|
|
7053
7082
|
destructiveHint: false,
|
|
7054
7083
|
idempotentHint: false,
|
|
7055
7084
|
openWorldHint: false
|
|
7056
7085
|
},
|
|
7057
|
-
tool:
|
|
7086
|
+
tool: createExperienceTemplate
|
|
7058
7087
|
},
|
|
7059
|
-
|
|
7060
|
-
title: "
|
|
7061
|
-
description: "Update an existing ExO template. You MUST call
|
|
7062
|
-
inputParams:
|
|
7088
|
+
upsertExperienceTemplate: {
|
|
7089
|
+
title: "upsert_experience_template",
|
|
7090
|
+
description: "Update an existing ExO experience template. You MUST call get_experience_template first to read the current state, then pass the sys.version you received as the version parameter. The handler merges your updates with the existing experience template fields, so you only need to provide the fields you want to change. If the version is stale (the experience template changed since you read it), the update is rejected and you must re-fetch with get_experience_template.",
|
|
7091
|
+
inputParams: UpsertExperienceTemplateToolParams.shape,
|
|
7063
7092
|
annotations: {
|
|
7064
7093
|
readOnlyHint: false,
|
|
7065
7094
|
destructiveHint: false,
|
|
7066
7095
|
idempotentHint: false,
|
|
7067
7096
|
openWorldHint: false
|
|
7068
7097
|
},
|
|
7069
|
-
tool:
|
|
7098
|
+
tool: upsertExperienceTemplate
|
|
7070
7099
|
},
|
|
7071
|
-
|
|
7072
|
-
title: "
|
|
7073
|
-
description: "Delete an ExO template. Two-phase: the first call (without confirm/confirmToken) returns a preview and a confirmToken. To complete the deletion, call again with the same
|
|
7074
|
-
inputParams:
|
|
7100
|
+
deleteExperienceTemplate: {
|
|
7101
|
+
title: "delete_experience_template",
|
|
7102
|
+
description: "Delete an ExO experience template. Two-phase: the first call (without confirm/confirmToken) returns a preview and a confirmToken. To complete the deletion, call again with the same experienceTemplateId, confirm: true, and the confirmToken from the preview.",
|
|
7103
|
+
inputParams: DeleteExperienceTemplateToolParams.shape,
|
|
7075
7104
|
annotations: {
|
|
7076
7105
|
readOnlyHint: false,
|
|
7077
7106
|
destructiveHint: true,
|
|
7078
7107
|
idempotentHint: false,
|
|
7079
7108
|
openWorldHint: false
|
|
7080
7109
|
},
|
|
7081
|
-
tool:
|
|
7110
|
+
tool: deleteExperienceTemplate
|
|
7082
7111
|
},
|
|
7083
|
-
|
|
7084
|
-
title: "
|
|
7085
|
-
description: "Publish an ExO template. You MUST call
|
|
7086
|
-
inputParams:
|
|
7112
|
+
publishExperienceTemplate: {
|
|
7113
|
+
title: "publish_experience_template",
|
|
7114
|
+
description: "Publish an ExO experience template. You MUST call get_experience_template first and pass the returned sys.version as the version parameter. If the version is stale the operation is rejected and you must re-fetch with get_experience_template.",
|
|
7115
|
+
inputParams: PublishExperienceTemplateToolParams.shape,
|
|
7087
7116
|
annotations: {
|
|
7088
7117
|
readOnlyHint: false,
|
|
7089
7118
|
destructiveHint: true,
|
|
7090
7119
|
idempotentHint: true,
|
|
7091
7120
|
openWorldHint: false
|
|
7092
7121
|
},
|
|
7093
|
-
tool:
|
|
7122
|
+
tool: publishExperienceTemplate
|
|
7094
7123
|
},
|
|
7095
|
-
|
|
7096
|
-
title: "
|
|
7097
|
-
description: "Unpublish an ExO template. You MUST call
|
|
7098
|
-
inputParams:
|
|
7124
|
+
unpublishExperienceTemplate: {
|
|
7125
|
+
title: "unpublish_experience_template",
|
|
7126
|
+
description: "Unpublish an ExO experience template. You MUST call get_experience_template first and pass the returned sys.version as the version parameter. If the version is stale the operation is rejected and you must re-fetch with get_experience_template.",
|
|
7127
|
+
inputParams: UnpublishExperienceTemplateToolParams.shape,
|
|
7099
7128
|
annotations: {
|
|
7100
7129
|
readOnlyHint: false,
|
|
7101
7130
|
destructiveHint: true,
|
|
7102
7131
|
idempotentHint: true,
|
|
7103
7132
|
openWorldHint: false
|
|
7104
7133
|
},
|
|
7105
|
-
tool:
|
|
7134
|
+
tool: unpublishExperienceTemplate
|
|
7106
7135
|
}
|
|
7107
7136
|
};
|
|
7108
7137
|
}
|
|
@@ -7164,18 +7193,11 @@ function listExperiencesTool(config) {
|
|
|
7164
7193
|
|
|
7165
7194
|
// src/tools/exo/experiences/createExperience.ts
|
|
7166
7195
|
import { z as z107 } from "zod";
|
|
7167
|
-
var TemplateResourceLinkSchema = z107.object({
|
|
7168
|
-
sys: z107.object({
|
|
7169
|
-
type: z107.literal("ResourceLink"),
|
|
7170
|
-
linkType: z107.literal("Contentful:Template"),
|
|
7171
|
-
urn: z107.string().describe("URN of the linked resource")
|
|
7172
|
-
})
|
|
7173
|
-
});
|
|
7174
7196
|
var CreateExperienceToolParams = BaseToolSchema.extend({
|
|
7175
7197
|
name: z107.string().describe("The name of the experience"),
|
|
7176
7198
|
description: z107.string().describe("Description of the experience"),
|
|
7177
|
-
|
|
7178
|
-
"Resource link to the
|
|
7199
|
+
experienceTemplate: ExperienceTemplateResourceLinkSchema.describe(
|
|
7200
|
+
"Resource link to the ExperienceTemplate this experience is backed by"
|
|
7179
7201
|
),
|
|
7180
7202
|
viewports: z107.array(ViewportSchema).describe("Viewport definitions for the experience (may be empty)"),
|
|
7181
7203
|
designProperties: z107.record(z107.string(), DimensionedDesignPropertyValueSchema).describe(
|
|
@@ -7185,7 +7207,7 @@ var CreateExperienceToolParams = BaseToolSchema.extend({
|
|
|
7185
7207
|
"Optional content bindings linking this experience to a data assembly"
|
|
7186
7208
|
),
|
|
7187
7209
|
slots: z107.record(z107.string(), z107.array(ExperienceSlotNodeSchema)).optional().describe(
|
|
7188
|
-
"Optional slot contents keyed by slot ID. Each value is an array of
|
|
7210
|
+
"Optional slot contents keyed by slot ID. Each value is an array of ExperienceFragmentNode or InlineExperienceFragmentNode."
|
|
7189
7211
|
),
|
|
7190
7212
|
metadata: ExperienceMetadataSchema.optional().describe(
|
|
7191
7213
|
"Optional ExO metadata (tags, concepts)"
|
|
@@ -7203,7 +7225,7 @@ function createExperienceTool(config) {
|
|
|
7203
7225
|
{
|
|
7204
7226
|
name: args.name,
|
|
7205
7227
|
description: args.description,
|
|
7206
|
-
|
|
7228
|
+
experienceTemplate: args.experienceTemplate,
|
|
7207
7229
|
viewports: args.viewports,
|
|
7208
7230
|
designProperties: args.designProperties,
|
|
7209
7231
|
...args.contentBindings && { contentBindings: args.contentBindings },
|
|
@@ -7234,9 +7256,7 @@ var UpsertExperienceToolParams = BaseToolSchema.extend({
|
|
|
7234
7256
|
contentBindings: ExperienceContentBindingsSchema.optional().describe(
|
|
7235
7257
|
"Content bindings linking this experience to a data assembly; replaces existing if provided"
|
|
7236
7258
|
),
|
|
7237
|
-
slots: z108.record(z108.string(), z108.array(ExperienceSlotNodeSchema)).optional().describe(
|
|
7238
|
-
"Slot contents keyed by slot ID; replaces existing if provided"
|
|
7239
|
-
),
|
|
7259
|
+
slots: z108.record(z108.string(), z108.array(ExperienceSlotNodeSchema)).optional().describe("Slot contents keyed by slot ID; replaces existing if provided"),
|
|
7240
7260
|
metadata: ExperienceMetadataSchema.optional().describe(
|
|
7241
7261
|
"ExO metadata (tags, concepts); replaces existing if provided"
|
|
7242
7262
|
)
|
|
@@ -7414,7 +7434,7 @@ function createExperienceTools(config) {
|
|
|
7414
7434
|
return {
|
|
7415
7435
|
getExperience: {
|
|
7416
7436
|
title: "get_experience",
|
|
7417
|
-
description: "Get details about a specific ExO experience (a concrete page or screen that composes a root
|
|
7437
|
+
description: "Get details about a specific ExO experience (a concrete page or screen that composes a root Component with content and design settings, backed by an ExperienceTemplate).",
|
|
7418
7438
|
inputParams: GetExperienceToolParams.shape,
|
|
7419
7439
|
annotations: {
|
|
7420
7440
|
readOnlyHint: true,
|
|
@@ -7436,7 +7456,7 @@ function createExperienceTools(config) {
|
|
|
7436
7456
|
},
|
|
7437
7457
|
createExperience: {
|
|
7438
7458
|
title: "create_experience",
|
|
7439
|
-
description: "Create a new ExO experience backed by
|
|
7459
|
+
description: "Create a new ExO experience backed by an ExperienceTemplate.",
|
|
7440
7460
|
inputParams: CreateExperienceToolParams.shape,
|
|
7441
7461
|
annotations: {
|
|
7442
7462
|
readOnlyHint: false,
|
|
@@ -8106,16 +8126,16 @@ var ContentfulMcpTools = class {
|
|
|
8106
8126
|
return createContentTypeTools(this.config);
|
|
8107
8127
|
}
|
|
8108
8128
|
/**
|
|
8109
|
-
* Get ExO component
|
|
8129
|
+
* Get ExO component tools
|
|
8110
8130
|
*/
|
|
8111
|
-
|
|
8112
|
-
return
|
|
8131
|
+
getComponentTools() {
|
|
8132
|
+
return createComponentTools(this.config);
|
|
8113
8133
|
}
|
|
8114
8134
|
/**
|
|
8115
|
-
* Get ExO template tools
|
|
8135
|
+
* Get ExO experience template tools
|
|
8116
8136
|
*/
|
|
8117
|
-
|
|
8118
|
-
return
|
|
8137
|
+
getExperienceTemplateTools() {
|
|
8138
|
+
return createExperienceTemplateTools(this.config);
|
|
8119
8139
|
}
|
|
8120
8140
|
/**
|
|
8121
8141
|
* Get ExO experience tools
|
|
@@ -8178,10 +8198,10 @@ var ContentfulMcpTools = class {
|
|
|
8178
8198
|
return createTaxonomyTools(this.config);
|
|
8179
8199
|
}
|
|
8180
8200
|
/**
|
|
8181
|
-
* Get ExO fragment tools
|
|
8201
|
+
* Get ExO experience fragment tools
|
|
8182
8202
|
*/
|
|
8183
|
-
|
|
8184
|
-
return
|
|
8203
|
+
getExperienceFragmentTools() {
|
|
8204
|
+
return createExperienceFragmentTools(this.config);
|
|
8185
8205
|
}
|
|
8186
8206
|
/**
|
|
8187
8207
|
* Get ExO data assembly tools
|