@contentful/mcp-tools 0.12.4 → 0.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.d.ts +145 -107
- package/dist/index.js +1073 -933
- 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({});
|
|
@@ -5231,55 +5231,169 @@ function createTaxonomyTools(config) {
|
|
|
5231
5231
|
};
|
|
5232
5232
|
}
|
|
5233
5233
|
|
|
5234
|
+
// src/tools/usage/getUsages.ts
|
|
5235
|
+
import { z as z78 } from "zod";
|
|
5236
|
+
import { createClient as createClient16 } from "contentful-management";
|
|
5237
|
+
var AGGREGATED_USAGE_METRIC_KEYS = [
|
|
5238
|
+
"api_call_cma",
|
|
5239
|
+
"api_call_cpa",
|
|
5240
|
+
"api_call_cda",
|
|
5241
|
+
"api_call_graphql",
|
|
5242
|
+
"asset_bandwidth",
|
|
5243
|
+
"functions_invocations",
|
|
5244
|
+
"ai_action_invocation",
|
|
5245
|
+
"ai_action_word_count",
|
|
5246
|
+
"ai_consumption_unit"
|
|
5247
|
+
];
|
|
5248
|
+
var FilterValueSchema = z78.union([
|
|
5249
|
+
z78.string().min(1),
|
|
5250
|
+
z78.array(z78.string().min(1)).min(1).max(10)
|
|
5251
|
+
]);
|
|
5252
|
+
var GetUsagesToolParams = z78.object({
|
|
5253
|
+
organizationId: z78.string().optional().describe(
|
|
5254
|
+
"Organization ID. If omitted, falls back to the ORGANIZATION_ID configured on the server."
|
|
5255
|
+
),
|
|
5256
|
+
metricKey: z78.enum(AGGREGATED_USAGE_METRIC_KEYS).describe(
|
|
5257
|
+
'Metric to aggregate. Availability depends on the products enabled for the organization. Allowed dimensions per metric (used by "group", "filter", and "order", all in the form sys.dimensions.<name>.sys.<suffix>): api_call_cma / api_call_cpa / api_call_cda / api_call_graphql \u2192 sys.dimensions.space.sys.id. asset_bandwidth \u2192 sys.dimensions.space.sys.id, sys.dimensions.asset.sys.id. functions_invocations \u2192 sys.dimensions.space.sys.id, sys.dimensions.app.sys.id, sys.dimensions.function.sys.id. ai_action_invocation / ai_action_word_count / ai_consumption_unit \u2192 sys.dimensions.space.sys.id, sys.dimensions.ai_action.sys.id, sys.dimensions.model.sys.provider, sys.dimensions.model.sys.id.'
|
|
5258
|
+
),
|
|
5259
|
+
dateGte: z78.string().describe(
|
|
5260
|
+
"Start date (inclusive) in ISO-8601 format (YYYY-MM-DD or full date-time). Sent as query param date[gte]. Max lookback: 12 months from now."
|
|
5261
|
+
),
|
|
5262
|
+
dateLte: z78.string().describe(
|
|
5263
|
+
"End date (inclusive) in ISO-8601 format (YYYY-MM-DD or full date-time). Sent as query param date[lte]."
|
|
5264
|
+
),
|
|
5265
|
+
granularity: z78.enum(["P1D", "P1M"]).optional().describe(
|
|
5266
|
+
'Bucket size as an ISO-8601 duration: "P1D" (daily, max 31-day range) or "P1M" (monthly, max 12 calendar months including current). Default P1D.'
|
|
5267
|
+
),
|
|
5268
|
+
group: z78.string().optional().describe(
|
|
5269
|
+
'Comma-separated dimension keys (in the form sys.dimensions.<name>.sys.<suffix>) to group results by. Values must come from the allowed dimensions for the chosen metricKey (see metricKey description), e.g. "sys.dimensions.space.sys.id" or "sys.dimensions.space.sys.id,sys.dimensions.function.sys.id".'
|
|
5270
|
+
),
|
|
5271
|
+
filter: z78.record(z78.string(), FilterValueSchema).optional().describe(
|
|
5272
|
+
'Filter by dimension values. Keys use the shape "sys.dimensions.<dimension>.sys.<attribute>", for example "sys.dimensions.space.sys.id" for the space_id dimension. Pass a string for a single-value filter or an array of up to 10 strings to filter by multiple values (uses the [in] operator). Available dimensions per metric are listed in the metricKey description.'
|
|
5273
|
+
),
|
|
5274
|
+
limit: z78.number().int().positive().max(1e3).optional().describe("Maximum number of items to return (1\u20131000, default 1000)."),
|
|
5275
|
+
skip: z78.number().int().min(0).max(1e4).optional().describe("Number of items to skip for pagination (0\u201310000, default 0)."),
|
|
5276
|
+
order: z78.string().optional().describe(
|
|
5277
|
+
'Column to sort by, in the form sys.dimensions.<name>.sys.<suffix>; prefix with "-" for descending (e.g. "-sys.dimensions.space.sys.id"). Allowed dimension columns match the metricKey (see metricKey description). The synthetic column "total_usage" is a bare token (e.g. "total_usage" or "-total_usage") and sums usage per group across the requested date range. When "group" is set, non-synthetic order columns must be a subset of grouped columns. Legacy underscore-form tokens (e.g. "space_id") return a 422.'
|
|
5278
|
+
)
|
|
5279
|
+
});
|
|
5280
|
+
function buildQuery(args) {
|
|
5281
|
+
const query = {};
|
|
5282
|
+
if (args.dateGte) query["date[gte]"] = args.dateGte;
|
|
5283
|
+
if (args.dateLte) query["date[lte]"] = args.dateLte;
|
|
5284
|
+
if (args.granularity) query["granularity"] = args.granularity;
|
|
5285
|
+
if (args.group) query["group"] = args.group;
|
|
5286
|
+
if (args.order) query["order"] = args.order;
|
|
5287
|
+
if (typeof args.limit === "number") query["limit"] = args.limit;
|
|
5288
|
+
if (typeof args.skip === "number") query["skip"] = args.skip;
|
|
5289
|
+
if (args.filter) {
|
|
5290
|
+
for (const [key, value] of Object.entries(args.filter)) {
|
|
5291
|
+
if (Array.isArray(value)) {
|
|
5292
|
+
query[`filter[${key}][in]`] = value.join(",");
|
|
5293
|
+
} else {
|
|
5294
|
+
query[`filter[${key}]`] = value;
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
}
|
|
5298
|
+
return query;
|
|
5299
|
+
}
|
|
5300
|
+
function getUsagesTool(config) {
|
|
5301
|
+
async function tool2(args) {
|
|
5302
|
+
const organizationId = args.organizationId ?? config.organizationId;
|
|
5303
|
+
if (!organizationId) {
|
|
5304
|
+
throw new Error(
|
|
5305
|
+
"organizationId is required (either as a tool argument or via the ORGANIZATION_ID env var)."
|
|
5306
|
+
);
|
|
5307
|
+
}
|
|
5308
|
+
const client = createClient16(createClientConfig(config), { type: "plain" });
|
|
5309
|
+
const metricKey = args.metricKey;
|
|
5310
|
+
const collection = await client.raw.get(
|
|
5311
|
+
`/organizations/${organizationId}/usages/${metricKey}`,
|
|
5312
|
+
{ params: buildQuery(args) }
|
|
5313
|
+
);
|
|
5314
|
+
const summarized = summarizeData(collection, {
|
|
5315
|
+
maxItems: 10,
|
|
5316
|
+
remainingMessage: "To see more usage buckets, please ask me to retrieve the next page using the skip parameter."
|
|
5317
|
+
});
|
|
5318
|
+
return createSuccessResponse("Usage retrieved successfully", {
|
|
5319
|
+
usage: summarized,
|
|
5320
|
+
total: collection.total,
|
|
5321
|
+
limit: collection.limit,
|
|
5322
|
+
skip: collection.skip,
|
|
5323
|
+
metricKey,
|
|
5324
|
+
organizationId
|
|
5325
|
+
});
|
|
5326
|
+
}
|
|
5327
|
+
return withErrorHandling(tool2, "Error retrieving usage");
|
|
5328
|
+
}
|
|
5329
|
+
|
|
5330
|
+
// src/tools/usage/register.ts
|
|
5331
|
+
function createUsageTools(config) {
|
|
5332
|
+
const getUsages = getUsagesTool(config);
|
|
5333
|
+
return {
|
|
5334
|
+
getUsages: {
|
|
5335
|
+
title: "get_usages",
|
|
5336
|
+
description: 'Get aggregated usage metrics for a Contentful organization, optionally scoped to one or more spaces (or other dimensions) via filter/group. Supports date-range windowing, ISO-8601 granularity (e.g. "P1D"), grouping by dimensions (e.g. group="sys.dimensions.space.sys.id"), and single-value / [in] filtering by dimensions (e.g. filter={"sys.dimensions.space.sys.id": "<space-id>"} or an array of up to 10 IDs). Use for questions like: "how much CMA traffic did this org make last month?", "which spaces used the most asset bandwidth this week?", "were there any AI action invocations for space X?".',
|
|
5337
|
+
inputParams: GetUsagesToolParams.shape,
|
|
5338
|
+
annotations: {
|
|
5339
|
+
readOnlyHint: true,
|
|
5340
|
+
destructiveHint: false,
|
|
5341
|
+
openWorldHint: false
|
|
5342
|
+
},
|
|
5343
|
+
tool: getUsages
|
|
5344
|
+
}
|
|
5345
|
+
};
|
|
5346
|
+
}
|
|
5347
|
+
|
|
5234
5348
|
// src/tools/jobs/space-to-space-migration/exportSpace.ts
|
|
5235
|
-
import { z as
|
|
5349
|
+
import { z as z80 } from "zod";
|
|
5236
5350
|
|
|
5237
5351
|
// src/types/querySchema.ts
|
|
5238
|
-
import { z as
|
|
5239
|
-
var EntryQuerySchema =
|
|
5240
|
-
content_type:
|
|
5241
|
-
include:
|
|
5242
|
-
select:
|
|
5243
|
-
links_to_entry:
|
|
5244
|
-
limit:
|
|
5245
|
-
skip:
|
|
5246
|
-
order:
|
|
5247
|
-
});
|
|
5248
|
-
var AssetQuerySchema =
|
|
5249
|
-
mimetype_group:
|
|
5250
|
-
select:
|
|
5251
|
-
limit:
|
|
5252
|
-
skip:
|
|
5253
|
-
order:
|
|
5352
|
+
import { z as z79 } from "zod";
|
|
5353
|
+
var EntryQuerySchema = z79.object({
|
|
5354
|
+
content_type: z79.string().optional().describe("Filter by content type"),
|
|
5355
|
+
include: z79.number().optional().describe("Include this many levels of linked entries"),
|
|
5356
|
+
select: z79.string().optional().describe("Comma-separated list of fields to return"),
|
|
5357
|
+
links_to_entry: z79.string().optional().describe("Find entries that link to the specified entry ID"),
|
|
5358
|
+
limit: z79.number().optional().describe("Maximum number of entries to return"),
|
|
5359
|
+
skip: z79.number().optional().describe("Skip this many entries"),
|
|
5360
|
+
order: z79.string().optional().describe("Order entries by this field")
|
|
5361
|
+
});
|
|
5362
|
+
var AssetQuerySchema = z79.object({
|
|
5363
|
+
mimetype_group: z79.string().optional().describe("Filter by MIME type group"),
|
|
5364
|
+
select: z79.string().optional().describe("Comma-separated list of fields to return"),
|
|
5365
|
+
limit: z79.number().optional().describe("Maximum number of assets to return"),
|
|
5366
|
+
skip: z79.number().optional().describe("Skip this many assets"),
|
|
5367
|
+
order: z79.string().optional().describe("Order assets by this field")
|
|
5254
5368
|
});
|
|
5255
5369
|
|
|
5256
5370
|
// src/tools/jobs/space-to-space-migration/exportSpace.ts
|
|
5257
5371
|
var ExportSpaceToolParams = BaseToolSchema.extend({
|
|
5258
|
-
exportDir:
|
|
5372
|
+
exportDir: z80.string().optional().describe(
|
|
5259
5373
|
"Directory to save the exported space data (optional, defaults to current directory)"
|
|
5260
5374
|
),
|
|
5261
|
-
saveFile:
|
|
5262
|
-
contentFile:
|
|
5263
|
-
includeDrafts:
|
|
5264
|
-
includeArchived:
|
|
5265
|
-
skipContentModel:
|
|
5266
|
-
skipEditorInterfaces:
|
|
5267
|
-
skipContent:
|
|
5268
|
-
skipRoles:
|
|
5269
|
-
skipTags:
|
|
5270
|
-
skipWebhooks:
|
|
5271
|
-
stripTags:
|
|
5272
|
-
contentOnly:
|
|
5375
|
+
saveFile: z80.boolean().optional().default(true).describe("Save the exported space data to a file"),
|
|
5376
|
+
contentFile: z80.string().optional().describe("Custom filename for the exported space data (optional)"),
|
|
5377
|
+
includeDrafts: z80.boolean().optional().default(false).describe("Include draft entries in the export"),
|
|
5378
|
+
includeArchived: z80.boolean().optional().default(false).describe("Include archived entries in the export"),
|
|
5379
|
+
skipContentModel: z80.boolean().optional().default(false).describe("Skip exporting content types"),
|
|
5380
|
+
skipEditorInterfaces: z80.boolean().optional().default(false).describe("Skip exporting editor interfaces"),
|
|
5381
|
+
skipContent: z80.boolean().optional().default(false).describe("Skip exporting entries and assets"),
|
|
5382
|
+
skipRoles: z80.boolean().optional().default(false).describe("Skip exporting roles and permissions"),
|
|
5383
|
+
skipTags: z80.boolean().optional().default(false).describe("Skip exporting tags"),
|
|
5384
|
+
skipWebhooks: z80.boolean().optional().default(false).describe("Skip exporting webhooks"),
|
|
5385
|
+
stripTags: z80.boolean().optional().default(false).describe("Untag assets and entries"),
|
|
5386
|
+
contentOnly: z80.boolean().optional().default(false).describe("Only export assets and entries"),
|
|
5273
5387
|
queryEntries: EntryQuerySchema.optional().describe(
|
|
5274
5388
|
"Export only entries that match query parameters"
|
|
5275
5389
|
),
|
|
5276
5390
|
queryAssets: AssetQuerySchema.optional().describe(
|
|
5277
5391
|
"Export only assets that match query parameters"
|
|
5278
5392
|
),
|
|
5279
|
-
downloadAssets:
|
|
5280
|
-
maxAllowedLimit:
|
|
5281
|
-
errorLogFile:
|
|
5282
|
-
useVerboseRenderer:
|
|
5393
|
+
downloadAssets: z80.boolean().optional().default(false).describe("Download actual asset files"),
|
|
5394
|
+
maxAllowedLimit: z80.number().optional().default(1e3).describe("Maximum number of items per request"),
|
|
5395
|
+
errorLogFile: z80.string().optional().describe("Path to error log output file"),
|
|
5396
|
+
useVerboseRenderer: z80.boolean().optional().describe("Line-by-line logging, useful for CI")
|
|
5283
5397
|
});
|
|
5284
5398
|
function createExportSpaceTool(config) {
|
|
5285
5399
|
async function tool2(args) {
|
|
@@ -5329,70 +5443,70 @@ function createExportSpaceTool(config) {
|
|
|
5329
5443
|
}
|
|
5330
5444
|
|
|
5331
5445
|
// src/tools/jobs/space-to-space-migration/paramCollection.ts
|
|
5332
|
-
import { z as
|
|
5446
|
+
import { z as z81 } from "zod";
|
|
5333
5447
|
var ParamCollectionToolParams = BaseToolSchema.extend({
|
|
5334
|
-
confirmation:
|
|
5448
|
+
confirmation: z81.boolean().optional().describe(
|
|
5335
5449
|
"User confirmation that they are ready to proceed with the workflow"
|
|
5336
5450
|
),
|
|
5337
|
-
export:
|
|
5338
|
-
spaceId:
|
|
5339
|
-
environmentId:
|
|
5340
|
-
deliveryToken:
|
|
5341
|
-
exportDir:
|
|
5342
|
-
saveFile:
|
|
5343
|
-
contentFile:
|
|
5344
|
-
includeDrafts:
|
|
5345
|
-
includeArchived:
|
|
5346
|
-
skipContentModel:
|
|
5347
|
-
skipEditorInterfaces:
|
|
5348
|
-
skipContent:
|
|
5349
|
-
skipRoles:
|
|
5350
|
-
skipTags:
|
|
5351
|
-
skipWebhooks:
|
|
5352
|
-
stripTags:
|
|
5353
|
-
contentOnly:
|
|
5451
|
+
export: z81.object({
|
|
5452
|
+
spaceId: z81.string().optional().describe("ID of the space with source data"),
|
|
5453
|
+
environmentId: z81.string().optional().describe("ID of the environment in the source space"),
|
|
5454
|
+
deliveryToken: z81.string().optional().describe("CDA token to export only published content (excludes tags)"),
|
|
5455
|
+
exportDir: z81.string().optional().describe("Path to export JSON output"),
|
|
5456
|
+
saveFile: z81.boolean().optional().describe("Save the export as a JSON file"),
|
|
5457
|
+
contentFile: z81.string().optional().describe("Filename for exported data"),
|
|
5458
|
+
includeDrafts: z81.boolean().optional().describe("Include drafts in exported entries"),
|
|
5459
|
+
includeArchived: z81.boolean().optional().describe("Include archived entries"),
|
|
5460
|
+
skipContentModel: z81.boolean().optional().describe("Skip exporting content models"),
|
|
5461
|
+
skipEditorInterfaces: z81.boolean().optional().describe("Skip exporting editor interfaces"),
|
|
5462
|
+
skipContent: z81.boolean().optional().describe("Skip exporting entries and assets"),
|
|
5463
|
+
skipRoles: z81.boolean().optional().describe("Skip exporting roles and permissions"),
|
|
5464
|
+
skipTags: z81.boolean().optional().describe("Skip exporting tags"),
|
|
5465
|
+
skipWebhooks: z81.boolean().optional().describe("Skip exporting webhooks"),
|
|
5466
|
+
stripTags: z81.boolean().optional().describe("Remove tags from entries and assets"),
|
|
5467
|
+
contentOnly: z81.boolean().optional().describe("Export only entries and assets"),
|
|
5354
5468
|
queryEntries: EntryQuerySchema.optional().describe(
|
|
5355
5469
|
"Export only entries that match query parameters"
|
|
5356
5470
|
),
|
|
5357
5471
|
queryAssets: AssetQuerySchema.optional().describe(
|
|
5358
5472
|
"Export only assets that match query parameters"
|
|
5359
5473
|
),
|
|
5360
|
-
downloadAssets:
|
|
5361
|
-
host:
|
|
5362
|
-
hostDelivery:
|
|
5363
|
-
proxy:
|
|
5364
|
-
rawProxy:
|
|
5365
|
-
maxAllowedLimit:
|
|
5366
|
-
headers:
|
|
5367
|
-
errorLogFile:
|
|
5368
|
-
useVerboseRenderer:
|
|
5369
|
-
config:
|
|
5474
|
+
downloadAssets: z81.boolean().optional().describe("Download asset files to disk"),
|
|
5475
|
+
host: z81.string().optional().describe("Management API host"),
|
|
5476
|
+
hostDelivery: z81.string().optional().describe("Delivery API host"),
|
|
5477
|
+
proxy: z81.string().optional().describe("HTTP/HTTPS proxy config"),
|
|
5478
|
+
rawProxy: z81.boolean().optional().describe("Pass raw proxy config directly to Axios"),
|
|
5479
|
+
maxAllowedLimit: z81.number().optional().describe("Page size for requests"),
|
|
5480
|
+
headers: z81.record(z81.any()).optional().describe("Additional headers to include in requests"),
|
|
5481
|
+
errorLogFile: z81.string().optional().describe("Path to error log output file"),
|
|
5482
|
+
useVerboseRenderer: z81.boolean().optional().describe("Line-by-line logging, useful for CI"),
|
|
5483
|
+
config: z81.string().optional().describe("Path to a JSON config file with all options")
|
|
5370
5484
|
}).optional(),
|
|
5371
|
-
import:
|
|
5372
|
-
spaceId:
|
|
5373
|
-
environmentId:
|
|
5374
|
-
contentFile:
|
|
5375
|
-
content:
|
|
5485
|
+
import: z81.object({
|
|
5486
|
+
spaceId: z81.string().optional().describe("ID of the space to import into"),
|
|
5487
|
+
environmentId: z81.string().optional().describe("Target environment in destination space"),
|
|
5488
|
+
contentFile: z81.string().optional().describe("Path to JSON file containing the content to import"),
|
|
5489
|
+
content: z81.record(z81.any()).optional().describe(
|
|
5376
5490
|
"JS object containing import content (must match expected structure)"
|
|
5377
5491
|
),
|
|
5378
|
-
contentModelOnly:
|
|
5379
|
-
skipContentModel:
|
|
5380
|
-
skipLocales:
|
|
5381
|
-
skipContentUpdates:
|
|
5382
|
-
skipContentPublishing:
|
|
5383
|
-
uploadAssets:
|
|
5384
|
-
skipAssetUpdates:
|
|
5385
|
-
assetsDirectory:
|
|
5386
|
-
timeout:
|
|
5387
|
-
retryLimit:
|
|
5388
|
-
host:
|
|
5389
|
-
proxy:
|
|
5390
|
-
rawProxy:
|
|
5391
|
-
rateLimit:
|
|
5392
|
-
headers:
|
|
5393
|
-
errorLogFile:
|
|
5394
|
-
useVerboseRenderer:
|
|
5395
|
-
config:
|
|
5492
|
+
contentModelOnly: z81.boolean().optional().describe("Import only content types"),
|
|
5493
|
+
skipContentModel: z81.boolean().optional().describe("Skip importing content types and locales"),
|
|
5494
|
+
skipLocales: z81.boolean().optional().describe("Skip importing locales"),
|
|
5495
|
+
skipContentUpdates: z81.boolean().optional().describe("Do not update existing content"),
|
|
5496
|
+
skipContentPublishing: z81.boolean().optional().describe("Create but do not publish content"),
|
|
5497
|
+
uploadAssets: z81.boolean().optional().describe("Upload asset files (requires assetsDirectory)"),
|
|
5498
|
+
skipAssetUpdates: z81.boolean().optional().describe("Do not update existing assets"),
|
|
5499
|
+
assetsDirectory: z81.string().optional().describe("Path to directory containing exported asset files"),
|
|
5500
|
+
timeout: z81.number().optional().describe("Time between retries during asset processing (ms)"),
|
|
5501
|
+
retryLimit: z81.number().optional().describe("Max retries for asset processing"),
|
|
5502
|
+
host: z81.string().optional().describe("Management API host"),
|
|
5503
|
+
proxy: z81.string().optional().describe("HTTP/HTTPS proxy string (host:port or user:pass@host:port)"),
|
|
5504
|
+
rawProxy: z81.boolean().optional().describe("Pass proxy config directly to Axios"),
|
|
5505
|
+
rateLimit: z81.number().optional().describe("Max requests per second to the API"),
|
|
5506
|
+
headers: z81.record(z81.any()).optional().describe("Additional headers to attach to requests"),
|
|
5507
|
+
errorLogFile: z81.string().optional().describe("Path to error log file"),
|
|
5508
|
+
useVerboseRenderer: z81.boolean().optional().describe("Line-by-line progress output (good for CI)"),
|
|
5509
|
+
config: z81.string().optional().describe("Path to config JSON file (merged with CLI args)")
|
|
5396
5510
|
}).optional()
|
|
5397
5511
|
});
|
|
5398
5512
|
var paramCollectionConfig = {
|
|
@@ -5508,25 +5622,25 @@ var createParamCollectionTool = withErrorHandling(
|
|
|
5508
5622
|
);
|
|
5509
5623
|
|
|
5510
5624
|
// src/tools/jobs/space-to-space-migration/importSpace.ts
|
|
5511
|
-
import { z as
|
|
5625
|
+
import { z as z82 } from "zod";
|
|
5512
5626
|
var ImportSpaceToolParams = BaseToolSchema.extend({
|
|
5513
|
-
contentFile:
|
|
5514
|
-
content:
|
|
5627
|
+
contentFile: z82.string().optional().describe("Path to JSON file containing the content to import"),
|
|
5628
|
+
content: z82.record(z82.any()).optional().describe(
|
|
5515
5629
|
"JS object containing import content (must match expected structure)"
|
|
5516
5630
|
),
|
|
5517
|
-
contentModelOnly:
|
|
5518
|
-
skipContentModel:
|
|
5519
|
-
skipLocales:
|
|
5520
|
-
skipContentUpdates:
|
|
5521
|
-
skipContentPublishing:
|
|
5522
|
-
uploadAssets:
|
|
5523
|
-
skipAssetUpdates:
|
|
5524
|
-
assetsDirectory:
|
|
5525
|
-
timeout:
|
|
5526
|
-
retryLimit:
|
|
5527
|
-
rateLimit:
|
|
5528
|
-
errorLogFile:
|
|
5529
|
-
useVerboseRenderer:
|
|
5631
|
+
contentModelOnly: z82.boolean().optional().default(false).describe("Import only content types"),
|
|
5632
|
+
skipContentModel: z82.boolean().optional().default(false).describe("Skip importing content types and locales"),
|
|
5633
|
+
skipLocales: z82.boolean().optional().default(false).describe("Skip importing locales"),
|
|
5634
|
+
skipContentUpdates: z82.boolean().optional().default(false).describe("Do not update existing content"),
|
|
5635
|
+
skipContentPublishing: z82.boolean().optional().default(false).describe("Create but do not publish content"),
|
|
5636
|
+
uploadAssets: z82.boolean().optional().default(false).describe("Upload asset files (requires assetsDirectory)"),
|
|
5637
|
+
skipAssetUpdates: z82.boolean().optional().default(false).describe("Do not update existing assets"),
|
|
5638
|
+
assetsDirectory: z82.string().optional().describe("Path to directory containing exported asset files"),
|
|
5639
|
+
timeout: z82.number().optional().default(3e3).describe("Time between retries during asset processing (ms)"),
|
|
5640
|
+
retryLimit: z82.number().optional().default(10).describe("Max retries for asset processing"),
|
|
5641
|
+
rateLimit: z82.number().optional().default(7).describe("Max requests per second to the API"),
|
|
5642
|
+
errorLogFile: z82.string().optional().describe("Path to error log file"),
|
|
5643
|
+
useVerboseRenderer: z82.boolean().optional().describe("Line-by-line progress output (good for CI)")
|
|
5530
5644
|
});
|
|
5531
5645
|
function createImportSpaceTool(config) {
|
|
5532
5646
|
async function tool2(args) {
|
|
@@ -5571,7 +5685,7 @@ function createImportSpaceTool(config) {
|
|
|
5571
5685
|
}
|
|
5572
5686
|
|
|
5573
5687
|
// src/tools/jobs/space-to-space-migration/migrationHandler.ts
|
|
5574
|
-
import { z as
|
|
5688
|
+
import { z as z83 } from "zod";
|
|
5575
5689
|
|
|
5576
5690
|
// src/tools/jobs/space-to-space-migration/instructions.ts
|
|
5577
5691
|
var S2S_MIGRATION_INSTRUCTIONS = `
|
|
@@ -5614,7 +5728,7 @@ The space to space migration workflow has been concluded and all related tools h
|
|
|
5614
5728
|
The workflow is now complete. You can start a new migration workflow by calling space_to_space_migration_handler with enableWorkflow=true if needed.
|
|
5615
5729
|
`;
|
|
5616
5730
|
var SpaceToSpaceMigrationHandlerToolParams = BaseToolSchema.extend({
|
|
5617
|
-
enableWorkflow:
|
|
5731
|
+
enableWorkflow: z83.boolean().describe(
|
|
5618
5732
|
"Set to true to enable the workflow tools, false to disable them and conclude the workflow"
|
|
5619
5733
|
)
|
|
5620
5734
|
});
|
|
@@ -5711,39 +5825,39 @@ function createJobTools(config) {
|
|
|
5711
5825
|
};
|
|
5712
5826
|
}
|
|
5713
5827
|
|
|
5714
|
-
// src/tools/exo/
|
|
5715
|
-
import { z as
|
|
5716
|
-
var
|
|
5717
|
-
|
|
5828
|
+
// src/tools/exo/components/getComponent.ts
|
|
5829
|
+
import { z as z84 } from "zod";
|
|
5830
|
+
var GetComponentToolParams = BaseToolSchema.extend({
|
|
5831
|
+
componentId: z84.string().describe("The ID of the component to retrieve details for")
|
|
5718
5832
|
});
|
|
5719
|
-
function
|
|
5833
|
+
function getComponentTool(config) {
|
|
5720
5834
|
async function tool2(args) {
|
|
5721
5835
|
const contentfulClient = createToolClient(config, args);
|
|
5722
|
-
const
|
|
5836
|
+
const component = await contentfulClient.component.get({
|
|
5723
5837
|
spaceId: args.spaceId,
|
|
5724
5838
|
environmentId: args.environmentId,
|
|
5725
|
-
|
|
5839
|
+
componentId: args.componentId
|
|
5726
5840
|
});
|
|
5727
|
-
return createSuccessResponse("Component
|
|
5728
|
-
|
|
5841
|
+
return createSuccessResponse("Component retrieved successfully", {
|
|
5842
|
+
component
|
|
5729
5843
|
});
|
|
5730
5844
|
}
|
|
5731
|
-
return withErrorHandling(tool2, "Error retrieving component
|
|
5845
|
+
return withErrorHandling(tool2, "Error retrieving component");
|
|
5732
5846
|
}
|
|
5733
5847
|
|
|
5734
|
-
// src/tools/exo/
|
|
5735
|
-
import { z as
|
|
5736
|
-
var
|
|
5737
|
-
limit:
|
|
5738
|
-
pageNext:
|
|
5739
|
-
pagePrev:
|
|
5740
|
-
order:
|
|
5848
|
+
// src/tools/exo/components/listComponents.ts
|
|
5849
|
+
import { z as z85 } from "zod";
|
|
5850
|
+
var ListComponentsToolParams = BaseToolSchema.extend({
|
|
5851
|
+
limit: z85.number().optional().describe("Maximum number of components to return (max 10)"),
|
|
5852
|
+
pageNext: z85.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
5853
|
+
pagePrev: z85.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
5854
|
+
order: z85.string().optional().describe("Order components by this field (e.g. sys.createdAt)")
|
|
5741
5855
|
});
|
|
5742
|
-
function
|
|
5856
|
+
function listComponentsTool(config) {
|
|
5743
5857
|
async function tool2(args) {
|
|
5744
5858
|
const contentfulClient = createToolClient(config, args);
|
|
5745
5859
|
const cursorParam = args.pageNext ? { pageNext: args.pageNext } : args.pagePrev ? { pagePrev: args.pagePrev } : {};
|
|
5746
|
-
const
|
|
5860
|
+
const components = await contentfulClient.component.getMany({
|
|
5747
5861
|
spaceId: args.spaceId,
|
|
5748
5862
|
environmentId: args.environmentId,
|
|
5749
5863
|
query: {
|
|
@@ -5752,116 +5866,123 @@ function listComponentTypesTool(config) {
|
|
|
5752
5866
|
...cursorParam
|
|
5753
5867
|
}
|
|
5754
5868
|
});
|
|
5755
|
-
const summarized = summarizeData(
|
|
5869
|
+
const summarized = summarizeData(components, {
|
|
5756
5870
|
maxItems: 10,
|
|
5757
|
-
remainingMessage: "To see more
|
|
5871
|
+
remainingMessage: "To see more components, ask me to retrieve the next page using the pageNext cursor."
|
|
5758
5872
|
});
|
|
5759
|
-
return createSuccessResponse("
|
|
5760
|
-
|
|
5761
|
-
total:
|
|
5762
|
-
limit:
|
|
5763
|
-
pages:
|
|
5873
|
+
return createSuccessResponse("Components retrieved successfully", {
|
|
5874
|
+
components: summarized,
|
|
5875
|
+
total: components.total,
|
|
5876
|
+
limit: components.limit,
|
|
5877
|
+
pages: components.pages
|
|
5764
5878
|
});
|
|
5765
5879
|
}
|
|
5766
|
-
return withErrorHandling(tool2, "Error listing
|
|
5880
|
+
return withErrorHandling(tool2, "Error listing components");
|
|
5767
5881
|
}
|
|
5768
5882
|
|
|
5769
|
-
// src/tools/exo/
|
|
5770
|
-
import { z as
|
|
5883
|
+
// src/tools/exo/components/createComponent.ts
|
|
5884
|
+
import { z as z87 } from "zod";
|
|
5771
5885
|
|
|
5772
|
-
// src/types/
|
|
5773
|
-
import { z as
|
|
5886
|
+
// src/types/exoSchemas.ts
|
|
5887
|
+
import { z as z86 } from "zod";
|
|
5774
5888
|
var URN_EXAMPLES = {
|
|
5775
|
-
"Contentful:
|
|
5776
|
-
"Contentful:
|
|
5777
|
-
"Contentful:
|
|
5889
|
+
"Contentful:Component": "crn:contentful:::experience:spaces/{spaceId}/environments/{envId}/components/{id}",
|
|
5890
|
+
"Contentful:ExperienceFragment": "crn:contentful:::experience:spaces/{spaceId}/environments/{envId}/experienceFragments/{id}",
|
|
5891
|
+
"Contentful:ExperienceTemplate": "crn:contentful:::experience:spaces/{spaceId}/environments/{envId}/experienceTemplates/{id}",
|
|
5778
5892
|
"Contentful:DataAssembly": "crn:contentful:::experience:spaces/{spaceId}/environments/{envId}/dataAssemblies/{id}"
|
|
5779
5893
|
};
|
|
5780
5894
|
var resourceLinkSchema2 = (linkType) => {
|
|
5781
5895
|
const example = URN_EXAMPLES[linkType];
|
|
5782
5896
|
const urnDesc = example ? `URN of the linked resource (e.g. "${example}")` : "URN of the linked resource";
|
|
5783
|
-
return
|
|
5784
|
-
sys:
|
|
5785
|
-
type:
|
|
5786
|
-
linkType:
|
|
5787
|
-
urn:
|
|
5897
|
+
return z86.object({
|
|
5898
|
+
sys: z86.object({
|
|
5899
|
+
type: z86.literal("ResourceLink"),
|
|
5900
|
+
linkType: z86.literal(linkType),
|
|
5901
|
+
urn: z86.string().describe(urnDesc)
|
|
5788
5902
|
})
|
|
5789
5903
|
});
|
|
5790
5904
|
};
|
|
5791
|
-
var linkSchema2 = (linkType) =>
|
|
5792
|
-
sys:
|
|
5793
|
-
type:
|
|
5794
|
-
linkType:
|
|
5795
|
-
id:
|
|
5905
|
+
var linkSchema2 = (linkType) => z86.object({
|
|
5906
|
+
sys: z86.object({
|
|
5907
|
+
type: z86.literal("Link"),
|
|
5908
|
+
linkType: z86.literal(linkType),
|
|
5909
|
+
id: z86.string()
|
|
5796
5910
|
})
|
|
5797
5911
|
});
|
|
5798
|
-
var
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5912
|
+
var ComponentResourceLinkSchema = resourceLinkSchema2(
|
|
5913
|
+
"Contentful:Component"
|
|
5914
|
+
);
|
|
5915
|
+
var ExperienceFragmentResourceLinkSchema = resourceLinkSchema2(
|
|
5916
|
+
"Contentful:ExperienceFragment"
|
|
5917
|
+
);
|
|
5918
|
+
var ExperienceTemplateResourceLinkSchema = resourceLinkSchema2(
|
|
5919
|
+
"Contentful:ExperienceTemplate"
|
|
5920
|
+
);
|
|
5921
|
+
var ViewportSchema = z86.object({
|
|
5922
|
+
id: z86.string().describe("Viewport identifier"),
|
|
5923
|
+
query: z86.string().describe("CSS media query string"),
|
|
5924
|
+
displayName: z86.string().describe("Human-readable viewport name"),
|
|
5925
|
+
previewSize: z86.string().describe('Preview size (e.g. "1024px")')
|
|
5926
|
+
});
|
|
5927
|
+
var DataTypeDefinitionSchema = z86.lazy(
|
|
5928
|
+
() => z86.discriminatedUnion("type", [
|
|
5929
|
+
z86.object({
|
|
5930
|
+
type: z86.enum(["String", "Number", "Integer", "Boolean"]),
|
|
5931
|
+
name: z86.string().optional(),
|
|
5932
|
+
required: z86.boolean().optional()
|
|
5812
5933
|
}),
|
|
5813
|
-
|
|
5814
|
-
type:
|
|
5815
|
-
name:
|
|
5816
|
-
required:
|
|
5934
|
+
z86.object({
|
|
5935
|
+
type: z86.literal("RichText"),
|
|
5936
|
+
name: z86.string().optional(),
|
|
5937
|
+
required: z86.boolean().optional()
|
|
5817
5938
|
}),
|
|
5818
|
-
|
|
5819
|
-
type:
|
|
5820
|
-
name:
|
|
5821
|
-
required:
|
|
5939
|
+
z86.object({
|
|
5940
|
+
type: z86.literal("Array"),
|
|
5941
|
+
name: z86.string().optional(),
|
|
5942
|
+
required: z86.boolean().optional(),
|
|
5822
5943
|
items: DataTypeDefinitionSchema
|
|
5823
5944
|
}),
|
|
5824
|
-
|
|
5825
|
-
type:
|
|
5826
|
-
name:
|
|
5827
|
-
required:
|
|
5828
|
-
fields:
|
|
5945
|
+
z86.object({
|
|
5946
|
+
type: z86.literal("Record"),
|
|
5947
|
+
name: z86.string().optional(),
|
|
5948
|
+
required: z86.boolean().optional(),
|
|
5949
|
+
fields: z86.record(z86.string(), DataTypeDefinitionSchema)
|
|
5829
5950
|
}),
|
|
5830
|
-
|
|
5831
|
-
type:
|
|
5832
|
-
name:
|
|
5833
|
-
required:
|
|
5834
|
-
ref:
|
|
5835
|
-
sys:
|
|
5836
|
-
type:
|
|
5837
|
-
linkType:
|
|
5838
|
-
urn:
|
|
5951
|
+
z86.object({
|
|
5952
|
+
type: z86.literal("TypeRef"),
|
|
5953
|
+
name: z86.string().optional(),
|
|
5954
|
+
required: z86.boolean().optional(),
|
|
5955
|
+
ref: z86.object({
|
|
5956
|
+
sys: z86.object({
|
|
5957
|
+
type: z86.literal("ResourceLink"),
|
|
5958
|
+
linkType: z86.string(),
|
|
5959
|
+
urn: z86.string()
|
|
5839
5960
|
})
|
|
5840
5961
|
})
|
|
5841
5962
|
}),
|
|
5842
|
-
|
|
5843
|
-
type:
|
|
5844
|
-
name:
|
|
5845
|
-
required:
|
|
5846
|
-
value:
|
|
5963
|
+
z86.object({
|
|
5964
|
+
type: z86.literal("Literal"),
|
|
5965
|
+
name: z86.string().optional(),
|
|
5966
|
+
required: z86.boolean().optional(),
|
|
5967
|
+
value: z86.custom().describe("JSON literal value"),
|
|
5847
5968
|
valueType: DataTypeDefinitionSchema
|
|
5848
5969
|
}),
|
|
5849
|
-
|
|
5850
|
-
type:
|
|
5851
|
-
name:
|
|
5852
|
-
required:
|
|
5853
|
-
discriminator:
|
|
5854
|
-
members:
|
|
5970
|
+
z86.object({
|
|
5971
|
+
type: z86.literal("DiscriminatedUnion"),
|
|
5972
|
+
name: z86.string().optional(),
|
|
5973
|
+
required: z86.boolean().optional(),
|
|
5974
|
+
discriminator: z86.string(),
|
|
5975
|
+
members: z86.array(DataTypeDefinitionSchema)
|
|
5855
5976
|
})
|
|
5856
5977
|
])
|
|
5857
5978
|
);
|
|
5858
|
-
var ContentPropertySchema =
|
|
5979
|
+
var ContentPropertySchema = z86.intersection(
|
|
5859
5980
|
DataTypeDefinitionSchema,
|
|
5860
|
-
|
|
5861
|
-
id:
|
|
5862
|
-
name:
|
|
5863
|
-
required:
|
|
5864
|
-
defaultValue:
|
|
5981
|
+
z86.object({
|
|
5982
|
+
id: z86.string().describe("Content property identifier"),
|
|
5983
|
+
name: z86.string().describe("Human-readable name"),
|
|
5984
|
+
required: z86.boolean().describe("Whether the property is required"),
|
|
5985
|
+
defaultValue: z86.unknown().optional().describe("Default value")
|
|
5865
5986
|
})
|
|
5866
5987
|
);
|
|
5867
5988
|
var DTCG_DESIGN_PROPERTY_TYPES = [
|
|
@@ -5879,192 +6000,198 @@ var DTCG_DESIGN_PROPERTY_TYPES = [
|
|
|
5879
6000
|
"DTCG.Gradient",
|
|
5880
6001
|
"DTCG.Typography"
|
|
5881
6002
|
];
|
|
5882
|
-
var DesignPropertyCommonFieldsSchema =
|
|
5883
|
-
id:
|
|
5884
|
-
name:
|
|
5885
|
-
description:
|
|
6003
|
+
var DesignPropertyCommonFieldsSchema = z86.object({
|
|
6004
|
+
id: z86.string().describe("Design property identifier"),
|
|
6005
|
+
name: z86.string().describe("Human-readable name"),
|
|
6006
|
+
description: z86.string().optional().describe("Optional description")
|
|
5886
6007
|
});
|
|
5887
6008
|
var StringDesignPropertySchema = DesignPropertyCommonFieldsSchema.extend({
|
|
5888
|
-
type:
|
|
5889
|
-
fallbackValue:
|
|
5890
|
-
type:
|
|
5891
|
-
value:
|
|
6009
|
+
type: z86.literal("String"),
|
|
6010
|
+
fallbackValue: z86.object({
|
|
6011
|
+
type: z86.literal("ManualDesignValue"),
|
|
6012
|
+
value: z86.string()
|
|
5892
6013
|
}).optional().describe("Manual fallback value for this design property"),
|
|
5893
|
-
validations:
|
|
5894
|
-
|
|
5895
|
-
regexp:
|
|
5896
|
-
pattern:
|
|
6014
|
+
validations: z86.array(
|
|
6015
|
+
z86.object({
|
|
6016
|
+
regexp: z86.object({
|
|
6017
|
+
pattern: z86.string().describe("Regular expression pattern")
|
|
5897
6018
|
})
|
|
5898
6019
|
})
|
|
5899
6020
|
).optional().describe("Regexp validations constraining allowed string values")
|
|
5900
6021
|
});
|
|
5901
6022
|
var BooleanDesignPropertySchema = DesignPropertyCommonFieldsSchema.extend({
|
|
5902
|
-
type:
|
|
5903
|
-
fallbackValue:
|
|
5904
|
-
type:
|
|
5905
|
-
value:
|
|
6023
|
+
type: z86.literal("Boolean"),
|
|
6024
|
+
fallbackValue: z86.object({
|
|
6025
|
+
type: z86.literal("ManualDesignValue"),
|
|
6026
|
+
value: z86.boolean()
|
|
5906
6027
|
}).optional().describe("Manual fallback value for this design property")
|
|
5907
6028
|
});
|
|
5908
|
-
var DesignTokenValueSchema =
|
|
5909
|
-
type:
|
|
5910
|
-
value:
|
|
5911
|
-
});
|
|
5912
|
-
var TokenBackedDesignPropertySchema = DesignPropertyCommonFieldsSchema.extend({
|
|
5913
|
-
type: z85.enum(DTCG_DESIGN_PROPERTY_TYPES),
|
|
5914
|
-
fallbackValue: DesignTokenValueSchema.optional().describe(
|
|
5915
|
-
"Design-token-backed fallback value for this design property"
|
|
5916
|
-
),
|
|
5917
|
-
allowedResources: z85.array(
|
|
5918
|
-
z85.object({
|
|
5919
|
-
type: z85.literal("DesignToken"),
|
|
5920
|
-
value: z85.string(),
|
|
5921
|
-
name: z85.string().optional()
|
|
5922
|
-
})
|
|
5923
|
-
).optional().describe("Allowed design token resources")
|
|
6029
|
+
var DesignTokenValueSchema = z86.object({
|
|
6030
|
+
type: z86.literal("DesignToken"),
|
|
6031
|
+
value: z86.string().min(1).describe("Design token reference (non-empty)")
|
|
5924
6032
|
});
|
|
5925
|
-
var
|
|
6033
|
+
var TokenBackedDesignPropertySchema = DesignPropertyCommonFieldsSchema.extend(
|
|
6034
|
+
{
|
|
6035
|
+
type: z86.enum(DTCG_DESIGN_PROPERTY_TYPES),
|
|
6036
|
+
fallbackValue: DesignTokenValueSchema.optional().describe(
|
|
6037
|
+
"Design-token-backed fallback value for this design property"
|
|
6038
|
+
),
|
|
6039
|
+
allowedResources: z86.array(
|
|
6040
|
+
z86.object({
|
|
6041
|
+
type: z86.literal("DesignToken"),
|
|
6042
|
+
value: z86.string(),
|
|
6043
|
+
name: z86.string().optional()
|
|
6044
|
+
})
|
|
6045
|
+
).optional().describe("Allowed design token resources")
|
|
6046
|
+
}
|
|
6047
|
+
);
|
|
6048
|
+
var DesignPropertySchema = z86.union([
|
|
5926
6049
|
StringDesignPropertySchema,
|
|
5927
6050
|
BooleanDesignPropertySchema,
|
|
5928
6051
|
TokenBackedDesignPropertySchema
|
|
5929
6052
|
]);
|
|
5930
|
-
var ManualDesignValueSchema =
|
|
5931
|
-
type:
|
|
5932
|
-
value:
|
|
6053
|
+
var ManualDesignValueSchema = z86.object({
|
|
6054
|
+
type: z86.literal("ManualDesignValue"),
|
|
6055
|
+
value: z86.union([z86.string(), z86.number(), z86.boolean()])
|
|
5933
6056
|
});
|
|
5934
|
-
var DesignPropertyValueSchema =
|
|
6057
|
+
var DesignPropertyValueSchema = z86.union([
|
|
5935
6058
|
ManualDesignValueSchema,
|
|
5936
6059
|
DesignTokenValueSchema
|
|
5937
6060
|
]);
|
|
5938
|
-
var DesignPropertyPointerValueSchema =
|
|
6061
|
+
var DesignPropertyPointerValueSchema = z86.custom(
|
|
5939
6062
|
(val) => typeof val === "string" && /^\$designProperties\//.test(val),
|
|
5940
6063
|
{ message: 'Must be a "$designProperties/..." pointer' }
|
|
5941
6064
|
);
|
|
5942
|
-
var DimensionedDesignPropertyValueSchema =
|
|
5943
|
-
|
|
6065
|
+
var DimensionedDesignPropertyValueSchema = z86.record(
|
|
6066
|
+
z86.string(),
|
|
5944
6067
|
DesignPropertyValueSchema
|
|
5945
6068
|
);
|
|
5946
|
-
var ComponentTreeDesignPropertyValueSchema =
|
|
6069
|
+
var ComponentTreeDesignPropertyValueSchema = z86.union([
|
|
5947
6070
|
DesignPropertyValueSchema,
|
|
5948
6071
|
DesignPropertyPointerValueSchema,
|
|
5949
6072
|
DimensionedDesignPropertyValueSchema
|
|
5950
6073
|
]);
|
|
5951
6074
|
var COMPONENT_TYPE_ALLOWED_RESOURCE_SOURCE = "crn:contentful:::experience:spaces/$self/environments/$self";
|
|
5952
|
-
var SlotDefinitionSchema =
|
|
5953
|
-
id:
|
|
5954
|
-
name:
|
|
5955
|
-
required:
|
|
5956
|
-
validations:
|
|
5957
|
-
|
|
5958
|
-
size:
|
|
5959
|
-
min:
|
|
5960
|
-
max:
|
|
6075
|
+
var SlotDefinitionSchema = z86.object({
|
|
6076
|
+
id: z86.string().describe("Slot identifier"),
|
|
6077
|
+
name: z86.string().describe("Human-readable name"),
|
|
6078
|
+
required: z86.boolean().describe("Whether the slot must be filled"),
|
|
6079
|
+
validations: z86.array(
|
|
6080
|
+
z86.object({
|
|
6081
|
+
size: z86.object({
|
|
6082
|
+
min: z86.number().optional(),
|
|
6083
|
+
max: z86.number().optional()
|
|
5961
6084
|
}).optional()
|
|
5962
6085
|
})
|
|
5963
6086
|
).describe("Slot cardinality validations"),
|
|
5964
|
-
allowedResources:
|
|
5965
|
-
|
|
5966
|
-
type:
|
|
5967
|
-
source:
|
|
5968
|
-
allowedTypes:
|
|
6087
|
+
allowedResources: z86.array(
|
|
6088
|
+
z86.object({
|
|
6089
|
+
type: z86.literal("Contentful:Component"),
|
|
6090
|
+
source: z86.literal(COMPONENT_TYPE_ALLOWED_RESOURCE_SOURCE),
|
|
6091
|
+
allowedTypes: z86.array(z86.string()).describe("IDs of components allowed in this slot")
|
|
5969
6092
|
})
|
|
5970
|
-
).optional().describe("Constrains which
|
|
5971
|
-
});
|
|
5972
|
-
var
|
|
5973
|
-
id:
|
|
5974
|
-
name:
|
|
5975
|
-
nodeType:
|
|
5976
|
-
|
|
6093
|
+
).optional().describe("Constrains which components may be placed in this slot")
|
|
6094
|
+
});
|
|
6095
|
+
var ExperienceFragmentNodeSchema = z86.object({
|
|
6096
|
+
id: z86.string().describe("Node identifier"),
|
|
6097
|
+
name: z86.string().optional().describe("Optional display name"),
|
|
6098
|
+
nodeType: z86.literal("ExperienceFragment").describe('Must be "ExperienceFragment"'),
|
|
6099
|
+
experienceFragment: ExperienceFragmentResourceLinkSchema.describe(
|
|
6100
|
+
"Resource link to the referenced experience fragment"
|
|
6101
|
+
)
|
|
5977
6102
|
});
|
|
5978
|
-
var SlotNodeSchema =
|
|
5979
|
-
id:
|
|
5980
|
-
nodeType:
|
|
5981
|
-
slotId:
|
|
6103
|
+
var SlotNodeSchema = z86.object({
|
|
6104
|
+
id: z86.string().describe("Node identifier"),
|
|
6105
|
+
nodeType: z86.literal("Slot").describe('Must be "Slot"'),
|
|
6106
|
+
slotId: z86.string().describe("ID of the slot definition to render")
|
|
5982
6107
|
});
|
|
5983
|
-
var TreeNodeSchema =
|
|
5984
|
-
() =>
|
|
6108
|
+
var TreeNodeSchema = z86.lazy(
|
|
6109
|
+
() => z86.union([ComponentNodeSchema, ExperienceFragmentNodeSchema, SlotNodeSchema])
|
|
5985
6110
|
);
|
|
5986
|
-
var ComponentNodeSchema =
|
|
5987
|
-
() =>
|
|
5988
|
-
id:
|
|
5989
|
-
name:
|
|
5990
|
-
nodeType:
|
|
5991
|
-
|
|
5992
|
-
"Resource link to the component
|
|
6111
|
+
var ComponentNodeSchema = z86.lazy(
|
|
6112
|
+
() => z86.object({
|
|
6113
|
+
id: z86.string().describe("Node identifier"),
|
|
6114
|
+
name: z86.string().optional().describe("Optional display name"),
|
|
6115
|
+
nodeType: z86.literal("Component").describe('Must be "Component"'),
|
|
6116
|
+
component: ComponentResourceLinkSchema.describe(
|
|
6117
|
+
"Resource link to the component to render"
|
|
5993
6118
|
),
|
|
5994
|
-
contentProperties:
|
|
5995
|
-
|
|
5996
|
-
|
|
6119
|
+
contentProperties: z86.union([
|
|
6120
|
+
z86.record(z86.string(), z86.unknown()),
|
|
6121
|
+
z86.string().describe('"$contentProperties/..." pointer')
|
|
5997
6122
|
]).describe(
|
|
5998
6123
|
'Content property bindings \u2014 values or "$contentProperties/..." pointers'
|
|
5999
6124
|
),
|
|
6000
|
-
designProperties:
|
|
6125
|
+
designProperties: z86.record(z86.string(), ComponentTreeDesignPropertyValueSchema).describe(
|
|
6001
6126
|
'Design property values \u2014 ManualDesignValue, DesignTokenValue, or "$designProperties/..." pointers'
|
|
6002
6127
|
),
|
|
6003
|
-
slots:
|
|
6128
|
+
slots: z86.record(z86.string(), z86.array(TreeNodeSchema)).describe("Child tree nodes keyed by slot ID")
|
|
6004
6129
|
})
|
|
6005
6130
|
);
|
|
6006
6131
|
var TagLinkSchema = linkSchema2("Tag");
|
|
6007
6132
|
var ConceptLinkSchema = linkSchema2("TaxonomyConcept");
|
|
6008
|
-
var ExoMetadataSchema =
|
|
6009
|
-
tags:
|
|
6010
|
-
concepts:
|
|
6133
|
+
var ExoMetadataSchema = z86.object({
|
|
6134
|
+
tags: z86.array(TagLinkSchema).optional().describe("Tags attached to this entity"),
|
|
6135
|
+
concepts: z86.array(ConceptLinkSchema).optional().describe("Taxonomy concepts attached to this entity")
|
|
6011
6136
|
});
|
|
6012
6137
|
var ExperienceMetadataSchema = ExoMetadataSchema.extend({
|
|
6013
|
-
name:
|
|
6138
|
+
name: z86.string().optional().describe("Variant label for this metadata entry")
|
|
6014
6139
|
});
|
|
6015
|
-
var DataAssemblyResourceLinkSchema = resourceLinkSchema2(
|
|
6016
|
-
|
|
6140
|
+
var DataAssemblyResourceLinkSchema = resourceLinkSchema2(
|
|
6141
|
+
"Contentful:DataAssembly"
|
|
6142
|
+
);
|
|
6143
|
+
var ExperienceContentBindingsSchema = z86.object({
|
|
6017
6144
|
sys: DataAssemblyResourceLinkSchema.shape.sys,
|
|
6018
|
-
parameters:
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
sys:
|
|
6022
|
-
type:
|
|
6023
|
-
linkType:
|
|
6024
|
-
urn:
|
|
6145
|
+
parameters: z86.record(
|
|
6146
|
+
z86.string(),
|
|
6147
|
+
z86.object({
|
|
6148
|
+
sys: z86.object({
|
|
6149
|
+
type: z86.literal("ResourceLink"),
|
|
6150
|
+
linkType: z86.string(),
|
|
6151
|
+
urn: z86.string()
|
|
6025
6152
|
})
|
|
6026
6153
|
})
|
|
6027
6154
|
).describe("Parameter bindings keyed by parameter ID")
|
|
6028
6155
|
});
|
|
6029
|
-
var
|
|
6030
|
-
() =>
|
|
6031
|
-
id:
|
|
6032
|
-
nodeType:
|
|
6033
|
-
|
|
6034
|
-
"Resource link to the component
|
|
6156
|
+
var InlineExperienceFragmentNodeSchema = z86.lazy(
|
|
6157
|
+
() => z86.object({
|
|
6158
|
+
id: z86.string().describe("Node identifier"),
|
|
6159
|
+
nodeType: z86.literal("InlineExperienceFragment").describe('Must be "InlineExperienceFragment"'),
|
|
6160
|
+
component: ComponentResourceLinkSchema.describe(
|
|
6161
|
+
"Resource link to the component this inline experience fragment renders"
|
|
6035
6162
|
),
|
|
6036
|
-
designProperties:
|
|
6163
|
+
designProperties: z86.record(z86.string(), DimensionedDesignPropertyValueSchema).describe("Design property values for this inline experience fragment"),
|
|
6037
6164
|
contentBindings: ExperienceContentBindingsSchema.optional().describe(
|
|
6038
|
-
"Optional content bindings linking this inline fragment to a data assembly"
|
|
6165
|
+
"Optional content bindings linking this inline experience fragment to a data assembly"
|
|
6039
6166
|
),
|
|
6040
|
-
slots:
|
|
6167
|
+
slots: z86.record(z86.string(), z86.array(ExperienceSlotNodeSchema)).optional().describe("Child slot contents keyed by slot ID")
|
|
6041
6168
|
})
|
|
6042
6169
|
);
|
|
6043
|
-
var ExperienceSlotNodeSchema =
|
|
6044
|
-
() =>
|
|
6170
|
+
var ExperienceSlotNodeSchema = z86.lazy(
|
|
6171
|
+
() => z86.union([ExperienceFragmentNodeSchema, InlineExperienceFragmentNodeSchema])
|
|
6045
6172
|
);
|
|
6046
6173
|
|
|
6047
|
-
// src/tools/exo/
|
|
6048
|
-
var
|
|
6049
|
-
name:
|
|
6050
|
-
description:
|
|
6051
|
-
viewports:
|
|
6052
|
-
contentProperties:
|
|
6053
|
-
designProperties:
|
|
6054
|
-
componentTree:
|
|
6055
|
-
slots:
|
|
6174
|
+
// src/tools/exo/components/createComponent.ts
|
|
6175
|
+
var CreateComponentToolParams = BaseToolSchema.extend({
|
|
6176
|
+
name: z87.string().describe("The name of the component"),
|
|
6177
|
+
description: z87.string().describe("Description of the component"),
|
|
6178
|
+
viewports: z87.array(ViewportSchema).describe("Viewport definitions for the component (may be empty)"),
|
|
6179
|
+
contentProperties: z87.array(ContentPropertySchema).describe("Content property definitions (may be empty)"),
|
|
6180
|
+
designProperties: z87.array(DesignPropertySchema).describe("Design property definitions (may be empty)"),
|
|
6181
|
+
componentTree: z87.array(TreeNodeSchema).optional().describe("Optional component tree node definitions"),
|
|
6182
|
+
slots: z87.array(SlotDefinitionSchema).optional().describe("Optional slot definitions"),
|
|
6056
6183
|
metadata: ExoMetadataSchema.optional().describe(
|
|
6057
6184
|
"Optional ExO metadata (tags, concepts)"
|
|
6058
6185
|
)
|
|
6059
6186
|
});
|
|
6060
|
-
function
|
|
6187
|
+
function createComponentTool(config) {
|
|
6061
6188
|
async function tool2(args) {
|
|
6062
6189
|
assertEnvironmentNotProtected(
|
|
6063
6190
|
args.environmentId,
|
|
6064
6191
|
config.protectedEnvironments
|
|
6065
6192
|
);
|
|
6066
6193
|
const contentfulClient = createToolClient(config, args);
|
|
6067
|
-
const
|
|
6194
|
+
const component = await contentfulClient.component.create(
|
|
6068
6195
|
{ spaceId: args.spaceId, environmentId: args.environmentId },
|
|
6069
6196
|
{
|
|
6070
6197
|
name: args.name,
|
|
@@ -6077,32 +6204,32 @@ function createComponentTypeTool(config) {
|
|
|
6077
6204
|
...args.metadata && { metadata: args.metadata }
|
|
6078
6205
|
}
|
|
6079
6206
|
);
|
|
6080
|
-
return createSuccessResponse("Component
|
|
6081
|
-
|
|
6207
|
+
return createSuccessResponse("Component created successfully", {
|
|
6208
|
+
component
|
|
6082
6209
|
});
|
|
6083
6210
|
}
|
|
6084
|
-
return withErrorHandling(tool2, "Error creating component
|
|
6211
|
+
return withErrorHandling(tool2, "Error creating component");
|
|
6085
6212
|
}
|
|
6086
6213
|
|
|
6087
|
-
// src/tools/exo/
|
|
6088
|
-
import { z as
|
|
6089
|
-
var
|
|
6090
|
-
|
|
6091
|
-
version:
|
|
6092
|
-
"REQUIRED. The component
|
|
6214
|
+
// src/tools/exo/components/upsertComponent.ts
|
|
6215
|
+
import { z as z88 } from "zod";
|
|
6216
|
+
var UpsertComponentToolParams = BaseToolSchema.extend({
|
|
6217
|
+
componentId: z88.string().describe("The ID of the component to update"),
|
|
6218
|
+
version: z88.number().describe(
|
|
6219
|
+
"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
6220
|
),
|
|
6094
|
-
name:
|
|
6095
|
-
description:
|
|
6096
|
-
viewports:
|
|
6097
|
-
contentProperties:
|
|
6098
|
-
designProperties:
|
|
6099
|
-
componentTree:
|
|
6100
|
-
slots:
|
|
6221
|
+
name: z88.string().optional().describe("The name of the component"),
|
|
6222
|
+
description: z88.string().optional().describe("Description of the component"),
|
|
6223
|
+
viewports: z88.array(ViewportSchema).optional().describe("Viewport definitions; replaces existing viewports if provided"),
|
|
6224
|
+
contentProperties: z88.array(ContentPropertySchema).optional().describe("Content property definitions; replaces existing if provided"),
|
|
6225
|
+
designProperties: z88.array(DesignPropertySchema).optional().describe("Design property definitions; replaces existing if provided"),
|
|
6226
|
+
componentTree: z88.array(TreeNodeSchema).optional().describe("Component tree node definitions; replaces existing if provided"),
|
|
6227
|
+
slots: z88.array(SlotDefinitionSchema).optional().describe("Slot definitions; replaces existing if provided"),
|
|
6101
6228
|
metadata: ExoMetadataSchema.optional().describe(
|
|
6102
6229
|
"ExO metadata (tags, concepts); replaces existing if provided"
|
|
6103
6230
|
)
|
|
6104
6231
|
});
|
|
6105
|
-
function
|
|
6232
|
+
function upsertComponentTool(config) {
|
|
6106
6233
|
async function tool2(args) {
|
|
6107
6234
|
assertEnvironmentNotProtected(
|
|
6108
6235
|
args.environmentId,
|
|
@@ -6111,19 +6238,19 @@ function upsertComponentTypeTool(config) {
|
|
|
6111
6238
|
const params = {
|
|
6112
6239
|
spaceId: args.spaceId,
|
|
6113
6240
|
environmentId: args.environmentId,
|
|
6114
|
-
|
|
6241
|
+
componentId: args.componentId
|
|
6115
6242
|
};
|
|
6116
6243
|
const contentfulClient = createToolClient(config, args);
|
|
6117
|
-
const current = await contentfulClient.
|
|
6244
|
+
const current = await contentfulClient.component.get(params);
|
|
6118
6245
|
if (args.version !== current.sys.version) {
|
|
6119
6246
|
throw new Error(
|
|
6120
|
-
`Version conflict: the component
|
|
6247
|
+
`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
6248
|
);
|
|
6122
6249
|
}
|
|
6123
|
-
const
|
|
6250
|
+
const component = await contentfulClient.component.upsert(params, {
|
|
6124
6251
|
sys: {
|
|
6125
6252
|
id: current.sys.id,
|
|
6126
|
-
type: "
|
|
6253
|
+
type: "Component",
|
|
6127
6254
|
version: current.sys.version
|
|
6128
6255
|
},
|
|
6129
6256
|
name: args.name ?? current.name,
|
|
@@ -6136,25 +6263,25 @@ function upsertComponentTypeTool(config) {
|
|
|
6136
6263
|
...args.metadata ?? current.metadata ? { metadata: args.metadata ?? current.metadata } : {},
|
|
6137
6264
|
...current.dataAssemblies ? { dataAssemblies: current.dataAssemblies } : {}
|
|
6138
6265
|
});
|
|
6139
|
-
return createSuccessResponse("Component
|
|
6140
|
-
|
|
6266
|
+
return createSuccessResponse("Component updated successfully", {
|
|
6267
|
+
component
|
|
6141
6268
|
});
|
|
6142
6269
|
}
|
|
6143
|
-
return withErrorHandling(tool2, "Error updating component
|
|
6270
|
+
return withErrorHandling(tool2, "Error updating component");
|
|
6144
6271
|
}
|
|
6145
6272
|
|
|
6146
|
-
// src/tools/exo/
|
|
6147
|
-
import { z as
|
|
6148
|
-
var
|
|
6149
|
-
|
|
6150
|
-
confirm:
|
|
6273
|
+
// src/tools/exo/components/deleteComponent.ts
|
|
6274
|
+
import { z as z89 } from "zod";
|
|
6275
|
+
var DeleteComponentToolParams = BaseToolSchema.extend({
|
|
6276
|
+
componentId: z89.string().describe("The ID of the component to delete"),
|
|
6277
|
+
confirm: z89.boolean().optional().describe(
|
|
6151
6278
|
"Set to true on the second call to actually perform the deletion. Required together with confirmToken."
|
|
6152
6279
|
),
|
|
6153
|
-
confirmToken:
|
|
6280
|
+
confirmToken: z89.string().optional().describe(
|
|
6154
6281
|
"Token returned by the preview call; must be supplied with confirm: true."
|
|
6155
6282
|
)
|
|
6156
6283
|
});
|
|
6157
|
-
function
|
|
6284
|
+
function deleteComponentTool(config) {
|
|
6158
6285
|
async function tool2(args) {
|
|
6159
6286
|
assertEnvironmentNotProtected(
|
|
6160
6287
|
args.environmentId,
|
|
@@ -6163,43 +6290,43 @@ function deleteComponentTypeTool(config) {
|
|
|
6163
6290
|
const params = {
|
|
6164
6291
|
spaceId: args.spaceId,
|
|
6165
6292
|
environmentId: args.environmentId,
|
|
6166
|
-
|
|
6293
|
+
componentId: args.componentId
|
|
6167
6294
|
};
|
|
6168
6295
|
const contentfulClient = createToolClient(config, args);
|
|
6169
|
-
const
|
|
6296
|
+
const component = await contentfulClient.component.get(params);
|
|
6170
6297
|
const expectedToken = buildConfirmToken(
|
|
6171
|
-
"
|
|
6172
|
-
args.
|
|
6173
|
-
|
|
6298
|
+
"component",
|
|
6299
|
+
args.componentId,
|
|
6300
|
+
component.sys.version
|
|
6174
6301
|
);
|
|
6175
6302
|
if (args.confirm !== true || args.confirmToken !== expectedToken) {
|
|
6176
6303
|
return createSuccessResponse(
|
|
6177
|
-
`${CONFIRMATION_MESSAGE_PREFIX} component
|
|
6304
|
+
`${CONFIRMATION_MESSAGE_PREFIX} component`,
|
|
6178
6305
|
buildConfirmationPreview(
|
|
6179
|
-
"
|
|
6180
|
-
args.
|
|
6181
|
-
{
|
|
6306
|
+
"component",
|
|
6307
|
+
args.componentId,
|
|
6308
|
+
{ component },
|
|
6182
6309
|
expectedToken
|
|
6183
6310
|
)
|
|
6184
6311
|
);
|
|
6185
6312
|
}
|
|
6186
|
-
await contentfulClient.
|
|
6187
|
-
return createSuccessResponse("Component
|
|
6188
|
-
|
|
6313
|
+
await contentfulClient.component.delete(params);
|
|
6314
|
+
return createSuccessResponse("Component deleted successfully", {
|
|
6315
|
+
componentId: args.componentId
|
|
6189
6316
|
});
|
|
6190
6317
|
}
|
|
6191
|
-
return withErrorHandling(tool2, "Error deleting component
|
|
6318
|
+
return withErrorHandling(tool2, "Error deleting component");
|
|
6192
6319
|
}
|
|
6193
6320
|
|
|
6194
|
-
// src/tools/exo/
|
|
6195
|
-
import { z as
|
|
6196
|
-
var
|
|
6197
|
-
|
|
6198
|
-
version:
|
|
6199
|
-
"REQUIRED. The component
|
|
6321
|
+
// src/tools/exo/components/publishComponent.ts
|
|
6322
|
+
import { z as z90 } from "zod";
|
|
6323
|
+
var PublishComponentToolParams = BaseToolSchema.extend({
|
|
6324
|
+
componentId: z90.string().describe("The ID of the component to publish"),
|
|
6325
|
+
version: z90.number().describe(
|
|
6326
|
+
"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
6327
|
)
|
|
6201
6328
|
});
|
|
6202
|
-
function
|
|
6329
|
+
function publishComponentTool(config) {
|
|
6203
6330
|
async function tool2(args) {
|
|
6204
6331
|
assertEnvironmentNotProtected(
|
|
6205
6332
|
args.environmentId,
|
|
@@ -6208,35 +6335,35 @@ function publishComponentTypeTool(config) {
|
|
|
6208
6335
|
const params = {
|
|
6209
6336
|
spaceId: args.spaceId,
|
|
6210
6337
|
environmentId: args.environmentId,
|
|
6211
|
-
|
|
6338
|
+
componentId: args.componentId
|
|
6212
6339
|
};
|
|
6213
6340
|
const contentfulClient = createToolClient(config, args);
|
|
6214
|
-
const current = await contentfulClient.
|
|
6341
|
+
const current = await contentfulClient.component.get(params);
|
|
6215
6342
|
if (args.version !== current.sys.version) {
|
|
6216
6343
|
throw new Error(
|
|
6217
|
-
`Version conflict: the component
|
|
6344
|
+
`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
6345
|
);
|
|
6219
6346
|
}
|
|
6220
|
-
const
|
|
6347
|
+
const component = await contentfulClient.component.publish({
|
|
6221
6348
|
...params,
|
|
6222
6349
|
version: args.version
|
|
6223
6350
|
});
|
|
6224
|
-
return createSuccessResponse("Component
|
|
6225
|
-
|
|
6351
|
+
return createSuccessResponse("Component published successfully", {
|
|
6352
|
+
component
|
|
6226
6353
|
});
|
|
6227
6354
|
}
|
|
6228
|
-
return withErrorHandling(tool2, "Error publishing component
|
|
6355
|
+
return withErrorHandling(tool2, "Error publishing component");
|
|
6229
6356
|
}
|
|
6230
6357
|
|
|
6231
|
-
// src/tools/exo/
|
|
6232
|
-
import { z as
|
|
6233
|
-
var
|
|
6234
|
-
|
|
6235
|
-
version:
|
|
6236
|
-
"REQUIRED. The component
|
|
6358
|
+
// src/tools/exo/components/unpublishComponent.ts
|
|
6359
|
+
import { z as z91 } from "zod";
|
|
6360
|
+
var UnpublishComponentToolParams = BaseToolSchema.extend({
|
|
6361
|
+
componentId: z91.string().describe("The ID of the component to unpublish"),
|
|
6362
|
+
version: z91.number().describe(
|
|
6363
|
+
"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
6364
|
)
|
|
6238
6365
|
});
|
|
6239
|
-
function
|
|
6366
|
+
function unpublishComponentTool(config) {
|
|
6240
6367
|
async function tool2(args) {
|
|
6241
6368
|
assertEnvironmentNotProtected(
|
|
6242
6369
|
args.environmentId,
|
|
@@ -6245,153 +6372,153 @@ function unpublishComponentTypeTool(config) {
|
|
|
6245
6372
|
const params = {
|
|
6246
6373
|
spaceId: args.spaceId,
|
|
6247
6374
|
environmentId: args.environmentId,
|
|
6248
|
-
|
|
6375
|
+
componentId: args.componentId
|
|
6249
6376
|
};
|
|
6250
6377
|
const contentfulClient = createToolClient(config, args);
|
|
6251
|
-
const current = await contentfulClient.
|
|
6378
|
+
const current = await contentfulClient.component.get(params);
|
|
6252
6379
|
if (args.version !== current.sys.version) {
|
|
6253
6380
|
throw new Error(
|
|
6254
|
-
`Version conflict: the component
|
|
6381
|
+
`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
6382
|
);
|
|
6256
6383
|
}
|
|
6257
|
-
const
|
|
6384
|
+
const component = await contentfulClient.component.unpublish({
|
|
6258
6385
|
...params,
|
|
6259
6386
|
version: args.version
|
|
6260
6387
|
});
|
|
6261
|
-
return createSuccessResponse("Component
|
|
6262
|
-
|
|
6388
|
+
return createSuccessResponse("Component unpublished successfully", {
|
|
6389
|
+
component
|
|
6263
6390
|
});
|
|
6264
6391
|
}
|
|
6265
|
-
return withErrorHandling(tool2, "Error unpublishing component
|
|
6392
|
+
return withErrorHandling(tool2, "Error unpublishing component");
|
|
6266
6393
|
}
|
|
6267
6394
|
|
|
6268
|
-
// src/tools/exo/
|
|
6269
|
-
function
|
|
6270
|
-
const
|
|
6271
|
-
const
|
|
6272
|
-
const
|
|
6273
|
-
const
|
|
6274
|
-
const
|
|
6275
|
-
const
|
|
6276
|
-
const
|
|
6395
|
+
// src/tools/exo/components/register.ts
|
|
6396
|
+
function createComponentTools(config) {
|
|
6397
|
+
const getComponent = getComponentTool(config);
|
|
6398
|
+
const listComponents = listComponentsTool(config);
|
|
6399
|
+
const createComponent = createComponentTool(config);
|
|
6400
|
+
const upsertComponent = upsertComponentTool(config);
|
|
6401
|
+
const deleteComponent = deleteComponentTool(config);
|
|
6402
|
+
const publishComponent = publishComponentTool(config);
|
|
6403
|
+
const unpublishComponent = unpublishComponentTool(config);
|
|
6277
6404
|
return {
|
|
6278
|
-
|
|
6279
|
-
title: "
|
|
6280
|
-
description: "Get details about a specific ExO component
|
|
6281
|
-
inputParams:
|
|
6405
|
+
getComponent: {
|
|
6406
|
+
title: "get_component",
|
|
6407
|
+
description: "Get details about a specific ExO component (a reusable section/pattern template defining slots, content properties, and design properties).",
|
|
6408
|
+
inputParams: GetComponentToolParams.shape,
|
|
6282
6409
|
annotations: {
|
|
6283
6410
|
readOnlyHint: true,
|
|
6284
6411
|
destructiveHint: false,
|
|
6285
6412
|
openWorldHint: false
|
|
6286
6413
|
},
|
|
6287
|
-
tool:
|
|
6414
|
+
tool: getComponent
|
|
6288
6415
|
},
|
|
6289
|
-
|
|
6290
|
-
title: "
|
|
6291
|
-
description: "List ExO
|
|
6292
|
-
inputParams:
|
|
6416
|
+
listComponents: {
|
|
6417
|
+
title: "list_components",
|
|
6418
|
+
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.",
|
|
6419
|
+
inputParams: ListComponentsToolParams.shape,
|
|
6293
6420
|
annotations: {
|
|
6294
6421
|
readOnlyHint: true,
|
|
6295
6422
|
destructiveHint: false,
|
|
6296
6423
|
openWorldHint: false
|
|
6297
6424
|
},
|
|
6298
|
-
tool:
|
|
6425
|
+
tool: listComponents
|
|
6299
6426
|
},
|
|
6300
|
-
|
|
6301
|
-
title: "
|
|
6302
|
-
description: "Create a new ExO component
|
|
6303
|
-
inputParams:
|
|
6427
|
+
createComponent: {
|
|
6428
|
+
title: "create_component",
|
|
6429
|
+
description: "Create a new ExO component.",
|
|
6430
|
+
inputParams: CreateComponentToolParams.shape,
|
|
6304
6431
|
annotations: {
|
|
6305
6432
|
readOnlyHint: false,
|
|
6306
6433
|
destructiveHint: false,
|
|
6307
6434
|
idempotentHint: false,
|
|
6308
6435
|
openWorldHint: false
|
|
6309
6436
|
},
|
|
6310
|
-
tool:
|
|
6437
|
+
tool: createComponent
|
|
6311
6438
|
},
|
|
6312
|
-
|
|
6313
|
-
title: "
|
|
6314
|
-
description: "Update an existing ExO component
|
|
6315
|
-
inputParams:
|
|
6439
|
+
upsertComponent: {
|
|
6440
|
+
title: "upsert_component",
|
|
6441
|
+
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.",
|
|
6442
|
+
inputParams: UpsertComponentToolParams.shape,
|
|
6316
6443
|
annotations: {
|
|
6317
6444
|
readOnlyHint: false,
|
|
6318
6445
|
destructiveHint: false,
|
|
6319
6446
|
idempotentHint: false,
|
|
6320
6447
|
openWorldHint: false
|
|
6321
6448
|
},
|
|
6322
|
-
tool:
|
|
6449
|
+
tool: upsertComponent
|
|
6323
6450
|
},
|
|
6324
|
-
|
|
6325
|
-
title: "
|
|
6326
|
-
description: "Delete an ExO component
|
|
6327
|
-
inputParams:
|
|
6451
|
+
deleteComponent: {
|
|
6452
|
+
title: "delete_component",
|
|
6453
|
+
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.",
|
|
6454
|
+
inputParams: DeleteComponentToolParams.shape,
|
|
6328
6455
|
annotations: {
|
|
6329
6456
|
readOnlyHint: false,
|
|
6330
6457
|
destructiveHint: true,
|
|
6331
6458
|
idempotentHint: false,
|
|
6332
6459
|
openWorldHint: false
|
|
6333
6460
|
},
|
|
6334
|
-
tool:
|
|
6461
|
+
tool: deleteComponent
|
|
6335
6462
|
},
|
|
6336
|
-
|
|
6337
|
-
title: "
|
|
6338
|
-
description: "Publish an ExO component
|
|
6339
|
-
inputParams:
|
|
6463
|
+
publishComponent: {
|
|
6464
|
+
title: "publish_component",
|
|
6465
|
+
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.",
|
|
6466
|
+
inputParams: PublishComponentToolParams.shape,
|
|
6340
6467
|
annotations: {
|
|
6341
6468
|
readOnlyHint: false,
|
|
6342
6469
|
destructiveHint: true,
|
|
6343
6470
|
idempotentHint: true,
|
|
6344
6471
|
openWorldHint: false
|
|
6345
6472
|
},
|
|
6346
|
-
tool:
|
|
6473
|
+
tool: publishComponent
|
|
6347
6474
|
},
|
|
6348
|
-
|
|
6349
|
-
title: "
|
|
6350
|
-
description: "Unpublish an ExO component
|
|
6351
|
-
inputParams:
|
|
6475
|
+
unpublishComponent: {
|
|
6476
|
+
title: "unpublish_component",
|
|
6477
|
+
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.",
|
|
6478
|
+
inputParams: UnpublishComponentToolParams.shape,
|
|
6352
6479
|
annotations: {
|
|
6353
6480
|
readOnlyHint: false,
|
|
6354
6481
|
destructiveHint: true,
|
|
6355
6482
|
idempotentHint: true,
|
|
6356
6483
|
openWorldHint: false
|
|
6357
6484
|
},
|
|
6358
|
-
tool:
|
|
6485
|
+
tool: unpublishComponent
|
|
6359
6486
|
}
|
|
6360
6487
|
};
|
|
6361
6488
|
}
|
|
6362
6489
|
|
|
6363
|
-
// src/tools/exo/fragments/
|
|
6364
|
-
import { z as
|
|
6365
|
-
var
|
|
6366
|
-
|
|
6490
|
+
// src/tools/exo/experience-fragments/getExperienceFragment.ts
|
|
6491
|
+
import { z as z92 } from "zod";
|
|
6492
|
+
var GetExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6493
|
+
experienceFragmentId: z92.string().describe("The ID of the experience fragment to retrieve details for")
|
|
6367
6494
|
});
|
|
6368
|
-
function
|
|
6495
|
+
function getExperienceFragmentTool(config) {
|
|
6369
6496
|
async function tool2(args) {
|
|
6370
6497
|
const contentfulClient = createToolClient(config, args);
|
|
6371
|
-
const
|
|
6498
|
+
const experienceFragment = await contentfulClient.experienceFragment.get({
|
|
6372
6499
|
spaceId: args.spaceId,
|
|
6373
6500
|
environmentId: args.environmentId,
|
|
6374
|
-
|
|
6501
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6375
6502
|
});
|
|
6376
|
-
return createSuccessResponse("
|
|
6377
|
-
|
|
6503
|
+
return createSuccessResponse("Experience fragment retrieved successfully", {
|
|
6504
|
+
experienceFragment
|
|
6378
6505
|
});
|
|
6379
6506
|
}
|
|
6380
|
-
return withErrorHandling(tool2, "Error retrieving fragment");
|
|
6507
|
+
return withErrorHandling(tool2, "Error retrieving experience fragment");
|
|
6381
6508
|
}
|
|
6382
6509
|
|
|
6383
|
-
// src/tools/exo/fragments/
|
|
6384
|
-
import { z as
|
|
6385
|
-
var
|
|
6386
|
-
limit:
|
|
6387
|
-
pageNext:
|
|
6388
|
-
pagePrev:
|
|
6389
|
-
order:
|
|
6510
|
+
// src/tools/exo/experience-fragments/listExperienceFragments.ts
|
|
6511
|
+
import { z as z93 } from "zod";
|
|
6512
|
+
var ListExperienceFragmentsToolParams = BaseToolSchema.extend({
|
|
6513
|
+
limit: z93.number().optional().describe("Maximum number of experience fragments to return (max 10)"),
|
|
6514
|
+
pageNext: z93.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
6515
|
+
pagePrev: z93.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
6516
|
+
order: z93.string().optional().describe("Order experience fragments by this field (e.g. sys.createdAt)")
|
|
6390
6517
|
});
|
|
6391
|
-
function
|
|
6518
|
+
function listExperienceFragmentsTool(config) {
|
|
6392
6519
|
async function tool2(args) {
|
|
6393
6520
|
const contentfulClient = createToolClient(config, args);
|
|
6394
|
-
const
|
|
6521
|
+
const experienceFragments = await contentfulClient.experienceFragment.getMany({
|
|
6395
6522
|
spaceId: args.spaceId,
|
|
6396
6523
|
environmentId: args.environmentId,
|
|
6397
6524
|
query: {
|
|
@@ -6401,51 +6528,53 @@ function listFragmentsTool(config) {
|
|
|
6401
6528
|
...args.order && { order: args.order }
|
|
6402
6529
|
}
|
|
6403
6530
|
});
|
|
6404
|
-
const summarized = summarizeData(
|
|
6531
|
+
const summarized = summarizeData(experienceFragments, {
|
|
6405
6532
|
maxItems: 10,
|
|
6406
|
-
remainingMessage: "To see more fragments, ask me to retrieve the next page using the pageNext cursor."
|
|
6533
|
+
remainingMessage: "To see more experience fragments, ask me to retrieve the next page using the pageNext cursor."
|
|
6407
6534
|
});
|
|
6408
|
-
return createSuccessResponse("
|
|
6409
|
-
|
|
6410
|
-
total:
|
|
6411
|
-
limit:
|
|
6412
|
-
pages:
|
|
6535
|
+
return createSuccessResponse("ExperienceFragments retrieved successfully", {
|
|
6536
|
+
experienceFragments: summarized,
|
|
6537
|
+
total: experienceFragments.total,
|
|
6538
|
+
limit: experienceFragments.limit,
|
|
6539
|
+
pages: experienceFragments.pages
|
|
6413
6540
|
});
|
|
6414
6541
|
}
|
|
6415
|
-
return withErrorHandling(tool2, "Error listing fragments");
|
|
6542
|
+
return withErrorHandling(tool2, "Error listing experience fragments");
|
|
6416
6543
|
}
|
|
6417
6544
|
|
|
6418
|
-
// src/tools/exo/fragments/
|
|
6419
|
-
import { z as
|
|
6420
|
-
var
|
|
6421
|
-
name:
|
|
6422
|
-
description:
|
|
6423
|
-
|
|
6424
|
-
"Resource link to the component
|
|
6545
|
+
// src/tools/exo/experience-fragments/createExperienceFragment.ts
|
|
6546
|
+
import { z as z94 } from "zod";
|
|
6547
|
+
var CreateExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6548
|
+
name: z94.string().describe("The name of the experience fragment"),
|
|
6549
|
+
description: z94.string().describe("Description of the experience fragment"),
|
|
6550
|
+
component: ComponentResourceLinkSchema.describe(
|
|
6551
|
+
"Resource link to the component this experience fragment is based on"
|
|
6552
|
+
),
|
|
6553
|
+
viewports: z94.array(ViewportSchema).describe("Viewport definitions (may be empty)"),
|
|
6554
|
+
designProperties: z94.record(z94.string(), DimensionedDesignPropertyValueSchema).describe(
|
|
6555
|
+
"Design property values keyed by property ID (may be empty object)"
|
|
6425
6556
|
),
|
|
6426
|
-
viewports: z93.array(ViewportSchema).describe("Viewport definitions (may be empty)"),
|
|
6427
|
-
designProperties: z93.record(z93.string(), DimensionedDesignPropertyValueSchema).describe("Design property values keyed by property ID (may be empty object)"),
|
|
6428
6557
|
contentBindings: ExperienceContentBindingsSchema.optional().describe(
|
|
6429
|
-
"Optional content bindings for the fragment"
|
|
6558
|
+
"Optional content bindings for the experience fragment"
|
|
6430
6559
|
),
|
|
6431
|
-
slots:
|
|
6560
|
+
slots: z94.record(z94.string(), z94.array(ExperienceSlotNodeSchema)).optional().describe("Optional slot node definitions keyed by slot ID"),
|
|
6432
6561
|
metadata: ExperienceMetadataSchema.optional().describe(
|
|
6433
6562
|
"Optional ExO metadata (tags, concepts)"
|
|
6434
6563
|
)
|
|
6435
6564
|
});
|
|
6436
|
-
function
|
|
6565
|
+
function createExperienceFragmentTool(config) {
|
|
6437
6566
|
async function tool2(args) {
|
|
6438
6567
|
assertEnvironmentNotProtected(
|
|
6439
6568
|
args.environmentId,
|
|
6440
6569
|
config.protectedEnvironments
|
|
6441
6570
|
);
|
|
6442
6571
|
const contentfulClient = createToolClient(config, args);
|
|
6443
|
-
const
|
|
6572
|
+
const experienceFragment = await contentfulClient.experienceFragment.create(
|
|
6444
6573
|
{ spaceId: args.spaceId, environmentId: args.environmentId },
|
|
6445
6574
|
{
|
|
6446
6575
|
name: args.name,
|
|
6447
6576
|
description: args.description,
|
|
6448
|
-
|
|
6577
|
+
component: args.component,
|
|
6449
6578
|
viewports: args.viewports,
|
|
6450
6579
|
designProperties: args.designProperties,
|
|
6451
6580
|
...args.contentBindings && { contentBindings: args.contentBindings },
|
|
@@ -6453,33 +6582,33 @@ function createFragmentTool(config) {
|
|
|
6453
6582
|
...args.metadata && { metadata: args.metadata }
|
|
6454
6583
|
}
|
|
6455
6584
|
);
|
|
6456
|
-
return createSuccessResponse("
|
|
6457
|
-
|
|
6585
|
+
return createSuccessResponse("Experience fragment created successfully", {
|
|
6586
|
+
experienceFragment
|
|
6458
6587
|
});
|
|
6459
6588
|
}
|
|
6460
|
-
return withErrorHandling(tool2, "Error creating fragment");
|
|
6589
|
+
return withErrorHandling(tool2, "Error creating experience fragment");
|
|
6461
6590
|
}
|
|
6462
6591
|
|
|
6463
|
-
// src/tools/exo/fragments/
|
|
6464
|
-
import { z as
|
|
6465
|
-
var
|
|
6466
|
-
|
|
6467
|
-
version:
|
|
6468
|
-
"REQUIRED. The fragment's sys.version as returned by
|
|
6592
|
+
// src/tools/exo/experience-fragments/updateExperienceFragment.ts
|
|
6593
|
+
import { z as z95 } from "zod";
|
|
6594
|
+
var UpdateExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6595
|
+
experienceFragmentId: z95.string().describe("The ID of the experience fragment to update"),
|
|
6596
|
+
version: z95.number().describe(
|
|
6597
|
+
"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
6598
|
),
|
|
6470
|
-
name:
|
|
6471
|
-
description:
|
|
6472
|
-
viewports:
|
|
6473
|
-
designProperties:
|
|
6599
|
+
name: z95.string().optional().describe("The name of the experience fragment"),
|
|
6600
|
+
description: z95.string().optional().describe("Description of the experience fragment"),
|
|
6601
|
+
viewports: z95.array(ViewportSchema).optional().describe("Viewport definitions; replaces existing viewports if provided"),
|
|
6602
|
+
designProperties: z95.record(z95.string(), DimensionedDesignPropertyValueSchema).optional().describe("Design property values; replaces existing if provided"),
|
|
6474
6603
|
contentBindings: ExperienceContentBindingsSchema.optional().describe(
|
|
6475
6604
|
"Content bindings; replaces existing if provided"
|
|
6476
6605
|
),
|
|
6477
|
-
slots:
|
|
6606
|
+
slots: z95.record(z95.string(), z95.array(ExperienceSlotNodeSchema)).optional().describe("Slot node definitions; replaces existing if provided"),
|
|
6478
6607
|
metadata: ExperienceMetadataSchema.optional().describe(
|
|
6479
6608
|
"ExO metadata (tags, concepts); replaces existing if provided"
|
|
6480
6609
|
)
|
|
6481
6610
|
});
|
|
6482
|
-
function
|
|
6611
|
+
function updateExperienceFragmentTool(config) {
|
|
6483
6612
|
async function tool2(args) {
|
|
6484
6613
|
assertEnvironmentNotProtected(
|
|
6485
6614
|
args.environmentId,
|
|
@@ -6488,48 +6617,51 @@ function updateFragmentTool(config) {
|
|
|
6488
6617
|
const params = {
|
|
6489
6618
|
spaceId: args.spaceId,
|
|
6490
6619
|
environmentId: args.environmentId,
|
|
6491
|
-
|
|
6620
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6492
6621
|
};
|
|
6493
6622
|
const contentfulClient = createToolClient(config, args);
|
|
6494
|
-
const current = await contentfulClient.
|
|
6623
|
+
const current = await contentfulClient.experienceFragment.get(params);
|
|
6495
6624
|
if (args.version !== current.sys.version) {
|
|
6496
6625
|
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
|
|
6626
|
+
`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
6627
|
);
|
|
6499
6628
|
}
|
|
6500
|
-
const
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6629
|
+
const experienceFragment = await contentfulClient.experienceFragment.upsert(
|
|
6630
|
+
params,
|
|
6631
|
+
{
|
|
6632
|
+
sys: {
|
|
6633
|
+
id: current.sys.id,
|
|
6634
|
+
type: "ExperienceFragment",
|
|
6635
|
+
version: current.sys.version
|
|
6636
|
+
},
|
|
6637
|
+
name: args.name ?? current.name,
|
|
6638
|
+
description: args.description ?? current.description,
|
|
6639
|
+
viewports: args.viewports ?? current.viewports,
|
|
6640
|
+
designProperties: args.designProperties ?? current.designProperties,
|
|
6641
|
+
...args.contentBindings ?? current.contentBindings ? { contentBindings: args.contentBindings ?? current.contentBindings } : {},
|
|
6642
|
+
...args.slots ?? current.slots ? { slots: args.slots ?? current.slots } : {},
|
|
6643
|
+
...args.metadata ?? current.metadata ? { metadata: args.metadata ?? current.metadata } : {}
|
|
6644
|
+
}
|
|
6645
|
+
);
|
|
6646
|
+
return createSuccessResponse("Experience fragment updated successfully", {
|
|
6647
|
+
experienceFragment
|
|
6516
6648
|
});
|
|
6517
6649
|
}
|
|
6518
|
-
return withErrorHandling(tool2, "Error updating fragment");
|
|
6650
|
+
return withErrorHandling(tool2, "Error updating experience fragment");
|
|
6519
6651
|
}
|
|
6520
6652
|
|
|
6521
|
-
// src/tools/exo/fragments/
|
|
6522
|
-
import { z as
|
|
6523
|
-
var
|
|
6524
|
-
|
|
6525
|
-
confirm:
|
|
6653
|
+
// src/tools/exo/experience-fragments/deleteExperienceFragment.ts
|
|
6654
|
+
import { z as z96 } from "zod";
|
|
6655
|
+
var DeleteExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6656
|
+
experienceFragmentId: z96.string().describe("The ID of the experience fragment to delete"),
|
|
6657
|
+
confirm: z96.boolean().optional().describe(
|
|
6526
6658
|
"Set to true on the second call to actually perform the deletion. Required together with confirmToken."
|
|
6527
6659
|
),
|
|
6528
|
-
confirmToken:
|
|
6660
|
+
confirmToken: z96.string().optional().describe(
|
|
6529
6661
|
"Token returned by the preview call; must be supplied with confirm: true."
|
|
6530
6662
|
)
|
|
6531
6663
|
});
|
|
6532
|
-
function
|
|
6664
|
+
function deleteExperienceFragmentTool(config) {
|
|
6533
6665
|
async function tool2(args) {
|
|
6534
6666
|
assertEnvironmentNotProtected(
|
|
6535
6667
|
args.environmentId,
|
|
@@ -6538,43 +6670,43 @@ function deleteFragmentTool(config) {
|
|
|
6538
6670
|
const params = {
|
|
6539
6671
|
spaceId: args.spaceId,
|
|
6540
6672
|
environmentId: args.environmentId,
|
|
6541
|
-
|
|
6673
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6542
6674
|
};
|
|
6543
6675
|
const contentfulClient = createToolClient(config, args);
|
|
6544
|
-
const
|
|
6676
|
+
const experienceFragment = await contentfulClient.experienceFragment.get(params);
|
|
6545
6677
|
const expectedToken = buildConfirmToken(
|
|
6546
|
-
"
|
|
6547
|
-
args.
|
|
6548
|
-
|
|
6678
|
+
"experienceFragment",
|
|
6679
|
+
args.experienceFragmentId,
|
|
6680
|
+
experienceFragment.sys.version
|
|
6549
6681
|
);
|
|
6550
6682
|
if (args.confirm !== true || args.confirmToken !== expectedToken) {
|
|
6551
6683
|
return createSuccessResponse(
|
|
6552
|
-
`${CONFIRMATION_MESSAGE_PREFIX} fragment`,
|
|
6684
|
+
`${CONFIRMATION_MESSAGE_PREFIX} experience fragment`,
|
|
6553
6685
|
buildConfirmationPreview(
|
|
6554
|
-
"
|
|
6555
|
-
args.
|
|
6556
|
-
{
|
|
6686
|
+
"experienceFragment",
|
|
6687
|
+
args.experienceFragmentId,
|
|
6688
|
+
{ experienceFragment },
|
|
6557
6689
|
expectedToken
|
|
6558
6690
|
)
|
|
6559
6691
|
);
|
|
6560
6692
|
}
|
|
6561
|
-
await contentfulClient.
|
|
6562
|
-
return createSuccessResponse("
|
|
6563
|
-
|
|
6693
|
+
await contentfulClient.experienceFragment.delete(params);
|
|
6694
|
+
return createSuccessResponse("Experience fragment deleted successfully", {
|
|
6695
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6564
6696
|
});
|
|
6565
6697
|
}
|
|
6566
|
-
return withErrorHandling(tool2, "Error deleting fragment");
|
|
6698
|
+
return withErrorHandling(tool2, "Error deleting experience fragment");
|
|
6567
6699
|
}
|
|
6568
6700
|
|
|
6569
|
-
// src/tools/exo/fragments/
|
|
6570
|
-
import { z as
|
|
6571
|
-
var
|
|
6572
|
-
|
|
6573
|
-
version:
|
|
6574
|
-
"REQUIRED. The fragment's sys.version as returned by
|
|
6701
|
+
// src/tools/exo/experience-fragments/publishExperienceFragment.ts
|
|
6702
|
+
import { z as z97 } from "zod";
|
|
6703
|
+
var PublishExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6704
|
+
experienceFragmentId: z97.string().describe("The ID of the experience fragment to publish"),
|
|
6705
|
+
version: z97.number().describe(
|
|
6706
|
+
"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
6707
|
)
|
|
6576
6708
|
});
|
|
6577
|
-
function
|
|
6709
|
+
function publishExperienceFragmentTool(config) {
|
|
6578
6710
|
async function tool2(args) {
|
|
6579
6711
|
assertEnvironmentNotProtected(
|
|
6580
6712
|
args.environmentId,
|
|
@@ -6583,35 +6715,35 @@ function publishFragmentTool(config) {
|
|
|
6583
6715
|
const params = {
|
|
6584
6716
|
spaceId: args.spaceId,
|
|
6585
6717
|
environmentId: args.environmentId,
|
|
6586
|
-
|
|
6718
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6587
6719
|
};
|
|
6588
6720
|
const contentfulClient = createToolClient(config, args);
|
|
6589
|
-
const current = await contentfulClient.
|
|
6721
|
+
const current = await contentfulClient.experienceFragment.get(params);
|
|
6590
6722
|
if (args.version !== current.sys.version) {
|
|
6591
6723
|
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
|
|
6724
|
+
`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
6725
|
);
|
|
6594
6726
|
}
|
|
6595
|
-
const
|
|
6727
|
+
const experienceFragment = await contentfulClient.experienceFragment.publish({
|
|
6596
6728
|
...params,
|
|
6597
6729
|
version: args.version
|
|
6598
6730
|
});
|
|
6599
|
-
return createSuccessResponse("
|
|
6600
|
-
|
|
6731
|
+
return createSuccessResponse("Experience fragment published successfully", {
|
|
6732
|
+
experienceFragment
|
|
6601
6733
|
});
|
|
6602
6734
|
}
|
|
6603
|
-
return withErrorHandling(tool2, "Error publishing fragment");
|
|
6735
|
+
return withErrorHandling(tool2, "Error publishing experience fragment");
|
|
6604
6736
|
}
|
|
6605
6737
|
|
|
6606
|
-
// src/tools/exo/fragments/
|
|
6607
|
-
import { z as
|
|
6608
|
-
var
|
|
6609
|
-
|
|
6610
|
-
version:
|
|
6611
|
-
"REQUIRED. The fragment's sys.version as returned by
|
|
6738
|
+
// src/tools/exo/experience-fragments/unpublishExperienceFragment.ts
|
|
6739
|
+
import { z as z98 } from "zod";
|
|
6740
|
+
var UnpublishExperienceFragmentToolParams = BaseToolSchema.extend({
|
|
6741
|
+
experienceFragmentId: z98.string().describe("The ID of the experience fragment to unpublish"),
|
|
6742
|
+
version: z98.number().describe(
|
|
6743
|
+
"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
6744
|
)
|
|
6613
6745
|
});
|
|
6614
|
-
function
|
|
6746
|
+
function unpublishExperienceFragmentTool(config) {
|
|
6615
6747
|
async function tool2(args) {
|
|
6616
6748
|
assertEnvironmentNotProtected(
|
|
6617
6749
|
args.environmentId,
|
|
@@ -6620,153 +6752,156 @@ function unpublishFragmentTool(config) {
|
|
|
6620
6752
|
const params = {
|
|
6621
6753
|
spaceId: args.spaceId,
|
|
6622
6754
|
environmentId: args.environmentId,
|
|
6623
|
-
|
|
6755
|
+
experienceFragmentId: args.experienceFragmentId
|
|
6624
6756
|
};
|
|
6625
6757
|
const contentfulClient = createToolClient(config, args);
|
|
6626
|
-
const current = await contentfulClient.
|
|
6758
|
+
const current = await contentfulClient.experienceFragment.get(params);
|
|
6627
6759
|
if (args.version !== current.sys.version) {
|
|
6628
6760
|
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
|
|
6761
|
+
`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
6762
|
);
|
|
6631
6763
|
}
|
|
6632
|
-
const
|
|
6764
|
+
const experienceFragment = await contentfulClient.experienceFragment.unpublish({
|
|
6633
6765
|
...params,
|
|
6634
6766
|
version: args.version
|
|
6635
6767
|
});
|
|
6636
|
-
return createSuccessResponse(
|
|
6637
|
-
fragment
|
|
6638
|
-
|
|
6768
|
+
return createSuccessResponse(
|
|
6769
|
+
"Experience fragment unpublished successfully",
|
|
6770
|
+
{
|
|
6771
|
+
experienceFragment
|
|
6772
|
+
}
|
|
6773
|
+
);
|
|
6639
6774
|
}
|
|
6640
|
-
return withErrorHandling(tool2, "Error unpublishing fragment");
|
|
6775
|
+
return withErrorHandling(tool2, "Error unpublishing experience fragment");
|
|
6641
6776
|
}
|
|
6642
6777
|
|
|
6643
|
-
// src/tools/exo/fragments/register.ts
|
|
6644
|
-
function
|
|
6645
|
-
const
|
|
6646
|
-
const
|
|
6647
|
-
const
|
|
6648
|
-
const
|
|
6649
|
-
const
|
|
6650
|
-
const
|
|
6651
|
-
const
|
|
6778
|
+
// src/tools/exo/experience-fragments/register.ts
|
|
6779
|
+
function createExperienceFragmentTools(config) {
|
|
6780
|
+
const getExperienceFragment = getExperienceFragmentTool(config);
|
|
6781
|
+
const listExperienceFragments = listExperienceFragmentsTool(config);
|
|
6782
|
+
const createExperienceFragment = createExperienceFragmentTool(config);
|
|
6783
|
+
const updateExperienceFragment = updateExperienceFragmentTool(config);
|
|
6784
|
+
const deleteExperienceFragment = deleteExperienceFragmentTool(config);
|
|
6785
|
+
const publishExperienceFragment = publishExperienceFragmentTool(config);
|
|
6786
|
+
const unpublishExperienceFragment = unpublishExperienceFragmentTool(config);
|
|
6652
6787
|
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:
|
|
6788
|
+
getExperienceFragment: {
|
|
6789
|
+
title: "get_experience_fragment",
|
|
6790
|
+
description: "Get details about a specific ExO experience fragment (a reusable content unit that can be referenced across multiple Experiences and Components).",
|
|
6791
|
+
inputParams: GetExperienceFragmentToolParams.shape,
|
|
6657
6792
|
annotations: {
|
|
6658
6793
|
readOnlyHint: true,
|
|
6659
6794
|
destructiveHint: false,
|
|
6660
6795
|
openWorldHint: false
|
|
6661
6796
|
},
|
|
6662
|
-
tool:
|
|
6797
|
+
tool: getExperienceFragment
|
|
6663
6798
|
},
|
|
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:
|
|
6799
|
+
listExperienceFragments: {
|
|
6800
|
+
title: "list_experience_fragments",
|
|
6801
|
+
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.",
|
|
6802
|
+
inputParams: ListExperienceFragmentsToolParams.shape,
|
|
6668
6803
|
annotations: {
|
|
6669
6804
|
readOnlyHint: true,
|
|
6670
6805
|
destructiveHint: false,
|
|
6671
6806
|
openWorldHint: false
|
|
6672
6807
|
},
|
|
6673
|
-
tool:
|
|
6808
|
+
tool: listExperienceFragments
|
|
6674
6809
|
},
|
|
6675
|
-
|
|
6676
|
-
title: "
|
|
6677
|
-
description: "Create a new ExO fragment.",
|
|
6678
|
-
inputParams:
|
|
6810
|
+
createExperienceFragment: {
|
|
6811
|
+
title: "create_experience_fragment",
|
|
6812
|
+
description: "Create a new ExO experience fragment.",
|
|
6813
|
+
inputParams: CreateExperienceFragmentToolParams.shape,
|
|
6679
6814
|
annotations: {
|
|
6680
6815
|
readOnlyHint: false,
|
|
6681
6816
|
destructiveHint: false,
|
|
6682
6817
|
idempotentHint: false,
|
|
6683
6818
|
openWorldHint: false
|
|
6684
6819
|
},
|
|
6685
|
-
tool:
|
|
6820
|
+
tool: createExperienceFragment
|
|
6686
6821
|
},
|
|
6687
|
-
|
|
6688
|
-
title: "
|
|
6689
|
-
description: "Update an existing ExO fragment. You MUST call
|
|
6690
|
-
inputParams:
|
|
6822
|
+
updateExperienceFragment: {
|
|
6823
|
+
title: "update_experience_fragment",
|
|
6824
|
+
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.",
|
|
6825
|
+
inputParams: UpdateExperienceFragmentToolParams.shape,
|
|
6691
6826
|
annotations: {
|
|
6692
6827
|
readOnlyHint: false,
|
|
6693
6828
|
destructiveHint: false,
|
|
6694
6829
|
idempotentHint: false,
|
|
6695
6830
|
openWorldHint: false
|
|
6696
6831
|
},
|
|
6697
|
-
tool:
|
|
6832
|
+
tool: updateExperienceFragment
|
|
6698
6833
|
},
|
|
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:
|
|
6834
|
+
deleteExperienceFragment: {
|
|
6835
|
+
title: "delete_experience_fragment",
|
|
6836
|
+
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.",
|
|
6837
|
+
inputParams: DeleteExperienceFragmentToolParams.shape,
|
|
6703
6838
|
annotations: {
|
|
6704
6839
|
readOnlyHint: false,
|
|
6705
6840
|
destructiveHint: true,
|
|
6706
6841
|
idempotentHint: false,
|
|
6707
6842
|
openWorldHint: false
|
|
6708
6843
|
},
|
|
6709
|
-
tool:
|
|
6844
|
+
tool: deleteExperienceFragment
|
|
6710
6845
|
},
|
|
6711
|
-
|
|
6712
|
-
title: "
|
|
6713
|
-
description: "Publish an ExO fragment. You MUST call
|
|
6714
|
-
inputParams:
|
|
6846
|
+
publishExperienceFragment: {
|
|
6847
|
+
title: "publish_experience_fragment",
|
|
6848
|
+
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.",
|
|
6849
|
+
inputParams: PublishExperienceFragmentToolParams.shape,
|
|
6715
6850
|
annotations: {
|
|
6716
6851
|
readOnlyHint: false,
|
|
6717
6852
|
destructiveHint: true,
|
|
6718
6853
|
idempotentHint: true,
|
|
6719
6854
|
openWorldHint: false
|
|
6720
6855
|
},
|
|
6721
|
-
tool:
|
|
6856
|
+
tool: publishExperienceFragment
|
|
6722
6857
|
},
|
|
6723
|
-
|
|
6724
|
-
title: "
|
|
6725
|
-
description: "Unpublish an ExO fragment. You MUST call
|
|
6726
|
-
inputParams:
|
|
6858
|
+
unpublishExperienceFragment: {
|
|
6859
|
+
title: "unpublish_experience_fragment",
|
|
6860
|
+
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.",
|
|
6861
|
+
inputParams: UnpublishExperienceFragmentToolParams.shape,
|
|
6727
6862
|
annotations: {
|
|
6728
6863
|
readOnlyHint: false,
|
|
6729
6864
|
destructiveHint: true,
|
|
6730
6865
|
idempotentHint: true,
|
|
6731
6866
|
openWorldHint: false
|
|
6732
6867
|
},
|
|
6733
|
-
tool:
|
|
6868
|
+
tool: unpublishExperienceFragment
|
|
6734
6869
|
}
|
|
6735
6870
|
};
|
|
6736
6871
|
}
|
|
6737
6872
|
|
|
6738
|
-
// src/tools/exo/templates/
|
|
6739
|
-
import { z as
|
|
6740
|
-
var
|
|
6741
|
-
|
|
6873
|
+
// src/tools/exo/experience-templates/getExperienceTemplate.ts
|
|
6874
|
+
import { z as z99 } from "zod";
|
|
6875
|
+
var GetExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
6876
|
+
experienceTemplateId: z99.string().describe("The ID of the experience template to retrieve details for")
|
|
6742
6877
|
});
|
|
6743
|
-
function
|
|
6878
|
+
function getExperienceTemplateTool(config) {
|
|
6744
6879
|
async function tool2(args) {
|
|
6745
6880
|
const contentfulClient = createToolClient(config, args);
|
|
6746
|
-
const
|
|
6881
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.get({
|
|
6747
6882
|
spaceId: args.spaceId,
|
|
6748
6883
|
environmentId: args.environmentId,
|
|
6749
|
-
|
|
6884
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6750
6885
|
});
|
|
6751
|
-
return createSuccessResponse("
|
|
6752
|
-
|
|
6886
|
+
return createSuccessResponse("Experience template retrieved successfully", {
|
|
6887
|
+
experienceTemplate
|
|
6753
6888
|
});
|
|
6754
6889
|
}
|
|
6755
|
-
return withErrorHandling(tool2, "Error retrieving template");
|
|
6890
|
+
return withErrorHandling(tool2, "Error retrieving experience template");
|
|
6756
6891
|
}
|
|
6757
6892
|
|
|
6758
|
-
// src/tools/exo/templates/
|
|
6759
|
-
import { z as
|
|
6760
|
-
var
|
|
6761
|
-
limit:
|
|
6762
|
-
pageNext:
|
|
6763
|
-
pagePrev:
|
|
6764
|
-
order:
|
|
6893
|
+
// src/tools/exo/experience-templates/listExperienceTemplates.ts
|
|
6894
|
+
import { z as z100 } from "zod";
|
|
6895
|
+
var ListExperienceTemplatesToolParams = BaseToolSchema.extend({
|
|
6896
|
+
limit: z100.number().optional().describe("Maximum number of experience templates to return (max 10)"),
|
|
6897
|
+
pageNext: z100.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
6898
|
+
pagePrev: z100.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
6899
|
+
order: z100.string().optional().describe("Order experience templates by this field (e.g. sys.createdAt)")
|
|
6765
6900
|
});
|
|
6766
|
-
function
|
|
6901
|
+
function listExperienceTemplatesTool(config) {
|
|
6767
6902
|
async function tool2(args) {
|
|
6768
6903
|
const contentfulClient = createToolClient(config, args);
|
|
6769
|
-
const
|
|
6904
|
+
const experienceTemplates = await contentfulClient.experienceTemplate.getMany({
|
|
6770
6905
|
spaceId: args.spaceId,
|
|
6771
6906
|
environmentId: args.environmentId,
|
|
6772
6907
|
query: {
|
|
@@ -6776,42 +6911,44 @@ function listTemplatesTool(config) {
|
|
|
6776
6911
|
...args.order && { order: args.order }
|
|
6777
6912
|
}
|
|
6778
6913
|
});
|
|
6779
|
-
const summarized = summarizeData(
|
|
6914
|
+
const summarized = summarizeData(experienceTemplates, {
|
|
6780
6915
|
maxItems: 10,
|
|
6781
|
-
remainingMessage: "To see more templates, ask me to retrieve the next page using the pageNext cursor."
|
|
6916
|
+
remainingMessage: "To see more experience templates, ask me to retrieve the next page using the pageNext cursor."
|
|
6782
6917
|
});
|
|
6783
|
-
return createSuccessResponse("
|
|
6784
|
-
|
|
6785
|
-
total:
|
|
6786
|
-
limit:
|
|
6787
|
-
pages:
|
|
6918
|
+
return createSuccessResponse("ExperienceTemplates retrieved successfully", {
|
|
6919
|
+
experienceTemplates: summarized,
|
|
6920
|
+
total: experienceTemplates.total,
|
|
6921
|
+
limit: experienceTemplates.limit,
|
|
6922
|
+
pages: experienceTemplates.pages
|
|
6788
6923
|
});
|
|
6789
6924
|
}
|
|
6790
|
-
return withErrorHandling(tool2, "Error listing templates");
|
|
6925
|
+
return withErrorHandling(tool2, "Error listing experience templates");
|
|
6791
6926
|
}
|
|
6792
6927
|
|
|
6793
|
-
// src/tools/exo/templates/
|
|
6794
|
-
import { z as
|
|
6795
|
-
var
|
|
6796
|
-
name:
|
|
6797
|
-
description:
|
|
6798
|
-
viewports:
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6928
|
+
// src/tools/exo/experience-templates/createExperienceTemplate.ts
|
|
6929
|
+
import { z as z101 } from "zod";
|
|
6930
|
+
var CreateExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
6931
|
+
name: z101.string().describe("The name of the experience template"),
|
|
6932
|
+
description: z101.string().describe("Description of the experience template"),
|
|
6933
|
+
viewports: z101.array(ViewportSchema).describe(
|
|
6934
|
+
"Viewport definitions for the experience template (may be empty)"
|
|
6935
|
+
),
|
|
6936
|
+
contentProperties: z101.array(ContentPropertySchema).describe("Content property definitions (may be empty)"),
|
|
6937
|
+
designProperties: z101.array(DesignPropertySchema).describe("Design property definitions (may be empty)"),
|
|
6938
|
+
componentTree: z101.array(TreeNodeSchema).optional().describe("Optional component tree node definitions"),
|
|
6939
|
+
slots: z101.array(SlotDefinitionSchema).optional().describe("Optional slot definitions"),
|
|
6803
6940
|
metadata: ExoMetadataSchema.optional().describe(
|
|
6804
6941
|
"Optional ExO metadata (tags, concepts)"
|
|
6805
6942
|
)
|
|
6806
6943
|
});
|
|
6807
|
-
function
|
|
6944
|
+
function createExperienceTemplateTool(config) {
|
|
6808
6945
|
async function tool2(args) {
|
|
6809
6946
|
assertEnvironmentNotProtected(
|
|
6810
6947
|
args.environmentId,
|
|
6811
6948
|
config.protectedEnvironments
|
|
6812
6949
|
);
|
|
6813
6950
|
const contentfulClient = createToolClient(config, args);
|
|
6814
|
-
const
|
|
6951
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.create(
|
|
6815
6952
|
{ spaceId: args.spaceId, environmentId: args.environmentId },
|
|
6816
6953
|
{
|
|
6817
6954
|
name: args.name,
|
|
@@ -6824,32 +6961,32 @@ function createTemplateTool(config) {
|
|
|
6824
6961
|
...args.metadata && { metadata: args.metadata }
|
|
6825
6962
|
}
|
|
6826
6963
|
);
|
|
6827
|
-
return createSuccessResponse("
|
|
6828
|
-
|
|
6964
|
+
return createSuccessResponse("Experience template created successfully", {
|
|
6965
|
+
experienceTemplate
|
|
6829
6966
|
});
|
|
6830
6967
|
}
|
|
6831
|
-
return withErrorHandling(tool2, "Error creating template");
|
|
6968
|
+
return withErrorHandling(tool2, "Error creating experience template");
|
|
6832
6969
|
}
|
|
6833
6970
|
|
|
6834
|
-
// src/tools/exo/templates/
|
|
6835
|
-
import { z as
|
|
6836
|
-
var
|
|
6837
|
-
|
|
6838
|
-
version:
|
|
6839
|
-
"REQUIRED. The template's sys.version as returned by
|
|
6971
|
+
// src/tools/exo/experience-templates/upsertExperienceTemplate.ts
|
|
6972
|
+
import { z as z102 } from "zod";
|
|
6973
|
+
var UpsertExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
6974
|
+
experienceTemplateId: z102.string().describe("The ID of the experience template to update"),
|
|
6975
|
+
version: z102.number().describe(
|
|
6976
|
+
"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
6977
|
),
|
|
6841
|
-
name:
|
|
6842
|
-
description:
|
|
6843
|
-
viewports:
|
|
6844
|
-
contentProperties:
|
|
6845
|
-
designProperties:
|
|
6846
|
-
componentTree:
|
|
6847
|
-
slots:
|
|
6978
|
+
name: z102.string().optional().describe("The name of the experience template"),
|
|
6979
|
+
description: z102.string().optional().describe("Description of the experience template"),
|
|
6980
|
+
viewports: z102.array(ViewportSchema).optional().describe("Viewport definitions; replaces existing viewports if provided"),
|
|
6981
|
+
contentProperties: z102.array(ContentPropertySchema).optional().describe("Content property definitions; replaces existing if provided"),
|
|
6982
|
+
designProperties: z102.array(DesignPropertySchema).optional().describe("Design property definitions; replaces existing if provided"),
|
|
6983
|
+
componentTree: z102.array(TreeNodeSchema).optional().describe("Component tree node definitions; replaces existing if provided"),
|
|
6984
|
+
slots: z102.array(SlotDefinitionSchema).optional().describe("Slot definitions; replaces existing if provided"),
|
|
6848
6985
|
metadata: ExoMetadataSchema.optional().describe(
|
|
6849
6986
|
"ExO metadata (tags, concepts); replaces existing if provided"
|
|
6850
6987
|
)
|
|
6851
6988
|
});
|
|
6852
|
-
function
|
|
6989
|
+
function upsertExperienceTemplateTool(config) {
|
|
6853
6990
|
async function tool2(args) {
|
|
6854
6991
|
assertEnvironmentNotProtected(
|
|
6855
6992
|
args.environmentId,
|
|
@@ -6858,50 +6995,53 @@ function upsertTemplateTool(config) {
|
|
|
6858
6995
|
const params = {
|
|
6859
6996
|
spaceId: args.spaceId,
|
|
6860
6997
|
environmentId: args.environmentId,
|
|
6861
|
-
|
|
6998
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6862
6999
|
};
|
|
6863
7000
|
const contentfulClient = createToolClient(config, args);
|
|
6864
|
-
const current = await contentfulClient.
|
|
7001
|
+
const current = await contentfulClient.experienceTemplate.get(params);
|
|
6865
7002
|
if (args.version !== current.sys.version) {
|
|
6866
7003
|
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
|
|
7004
|
+
`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
7005
|
);
|
|
6869
7006
|
}
|
|
6870
|
-
const
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
7007
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.upsert(
|
|
7008
|
+
params,
|
|
7009
|
+
{
|
|
7010
|
+
sys: {
|
|
7011
|
+
id: current.sys.id,
|
|
7012
|
+
type: "ExperienceTemplate",
|
|
7013
|
+
version: current.sys.version
|
|
7014
|
+
},
|
|
7015
|
+
name: args.name ?? current.name,
|
|
7016
|
+
description: args.description ?? current.description,
|
|
7017
|
+
viewports: args.viewports ?? current.viewports,
|
|
7018
|
+
contentProperties: args.contentProperties ?? current.contentProperties,
|
|
7019
|
+
designProperties: args.designProperties ?? current.designProperties,
|
|
7020
|
+
...args.componentTree ?? current.componentTree ? { componentTree: args.componentTree ?? current.componentTree } : {},
|
|
7021
|
+
...args.slots ?? current.slots ? { slots: args.slots ?? current.slots } : {},
|
|
7022
|
+
...args.metadata ?? current.metadata ? { metadata: args.metadata ?? current.metadata } : {},
|
|
7023
|
+
...current.dataAssemblies ? { dataAssemblies: current.dataAssemblies } : {}
|
|
7024
|
+
}
|
|
7025
|
+
);
|
|
7026
|
+
return createSuccessResponse("Experience template updated successfully", {
|
|
7027
|
+
experienceTemplate
|
|
6888
7028
|
});
|
|
6889
7029
|
}
|
|
6890
|
-
return withErrorHandling(tool2, "Error updating template");
|
|
7030
|
+
return withErrorHandling(tool2, "Error updating experience template");
|
|
6891
7031
|
}
|
|
6892
7032
|
|
|
6893
|
-
// src/tools/exo/templates/
|
|
6894
|
-
import { z as
|
|
6895
|
-
var
|
|
6896
|
-
|
|
6897
|
-
confirm:
|
|
7033
|
+
// src/tools/exo/experience-templates/deleteExperienceTemplate.ts
|
|
7034
|
+
import { z as z103 } from "zod";
|
|
7035
|
+
var DeleteExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
7036
|
+
experienceTemplateId: z103.string().describe("The ID of the experience template to delete"),
|
|
7037
|
+
confirm: z103.boolean().optional().describe(
|
|
6898
7038
|
"Set to true on the second call to actually perform the deletion. Required together with confirmToken."
|
|
6899
7039
|
),
|
|
6900
|
-
confirmToken:
|
|
7040
|
+
confirmToken: z103.string().optional().describe(
|
|
6901
7041
|
"Token returned by the preview call; must be supplied with confirm: true."
|
|
6902
7042
|
)
|
|
6903
7043
|
});
|
|
6904
|
-
function
|
|
7044
|
+
function deleteExperienceTemplateTool(config) {
|
|
6905
7045
|
async function tool2(args) {
|
|
6906
7046
|
assertEnvironmentNotProtected(
|
|
6907
7047
|
args.environmentId,
|
|
@@ -6910,43 +7050,43 @@ function deleteTemplateTool(config) {
|
|
|
6910
7050
|
const params = {
|
|
6911
7051
|
spaceId: args.spaceId,
|
|
6912
7052
|
environmentId: args.environmentId,
|
|
6913
|
-
|
|
7053
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6914
7054
|
};
|
|
6915
7055
|
const contentfulClient = createToolClient(config, args);
|
|
6916
|
-
const
|
|
7056
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.get(params);
|
|
6917
7057
|
const expectedToken = buildConfirmToken(
|
|
6918
|
-
"
|
|
6919
|
-
args.
|
|
6920
|
-
|
|
7058
|
+
"experienceTemplate",
|
|
7059
|
+
args.experienceTemplateId,
|
|
7060
|
+
experienceTemplate.sys.version
|
|
6921
7061
|
);
|
|
6922
7062
|
if (args.confirm !== true || args.confirmToken !== expectedToken) {
|
|
6923
7063
|
return createSuccessResponse(
|
|
6924
|
-
`${CONFIRMATION_MESSAGE_PREFIX} template`,
|
|
7064
|
+
`${CONFIRMATION_MESSAGE_PREFIX} experience template`,
|
|
6925
7065
|
buildConfirmationPreview(
|
|
6926
|
-
"
|
|
6927
|
-
args.
|
|
6928
|
-
{
|
|
7066
|
+
"experienceTemplate",
|
|
7067
|
+
args.experienceTemplateId,
|
|
7068
|
+
{ experienceTemplate },
|
|
6929
7069
|
expectedToken
|
|
6930
7070
|
)
|
|
6931
7071
|
);
|
|
6932
7072
|
}
|
|
6933
|
-
await contentfulClient.
|
|
6934
|
-
return createSuccessResponse("
|
|
6935
|
-
|
|
7073
|
+
await contentfulClient.experienceTemplate.delete(params);
|
|
7074
|
+
return createSuccessResponse("Experience template deleted successfully", {
|
|
7075
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6936
7076
|
});
|
|
6937
7077
|
}
|
|
6938
|
-
return withErrorHandling(tool2, "Error deleting template");
|
|
7078
|
+
return withErrorHandling(tool2, "Error deleting experience template");
|
|
6939
7079
|
}
|
|
6940
7080
|
|
|
6941
|
-
// src/tools/exo/templates/
|
|
6942
|
-
import { z as
|
|
6943
|
-
var
|
|
6944
|
-
|
|
6945
|
-
version:
|
|
6946
|
-
"REQUIRED. The template's sys.version as returned by
|
|
7081
|
+
// src/tools/exo/experience-templates/publishExperienceTemplate.ts
|
|
7082
|
+
import { z as z104 } from "zod";
|
|
7083
|
+
var PublishExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
7084
|
+
experienceTemplateId: z104.string().describe("The ID of the experience template to publish"),
|
|
7085
|
+
version: z104.number().describe(
|
|
7086
|
+
"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
7087
|
)
|
|
6948
7088
|
});
|
|
6949
|
-
function
|
|
7089
|
+
function publishExperienceTemplateTool(config) {
|
|
6950
7090
|
async function tool2(args) {
|
|
6951
7091
|
assertEnvironmentNotProtected(
|
|
6952
7092
|
args.environmentId,
|
|
@@ -6955,35 +7095,35 @@ function publishTemplateTool(config) {
|
|
|
6955
7095
|
const params = {
|
|
6956
7096
|
spaceId: args.spaceId,
|
|
6957
7097
|
environmentId: args.environmentId,
|
|
6958
|
-
|
|
7098
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6959
7099
|
};
|
|
6960
7100
|
const contentfulClient = createToolClient(config, args);
|
|
6961
|
-
const current = await contentfulClient.
|
|
7101
|
+
const current = await contentfulClient.experienceTemplate.get(params);
|
|
6962
7102
|
if (args.version !== current.sys.version) {
|
|
6963
7103
|
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
|
|
7104
|
+
`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
7105
|
);
|
|
6966
7106
|
}
|
|
6967
|
-
const
|
|
7107
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.publish({
|
|
6968
7108
|
...params,
|
|
6969
7109
|
version: args.version
|
|
6970
7110
|
});
|
|
6971
|
-
return createSuccessResponse("
|
|
6972
|
-
|
|
7111
|
+
return createSuccessResponse("Experience template published successfully", {
|
|
7112
|
+
experienceTemplate
|
|
6973
7113
|
});
|
|
6974
7114
|
}
|
|
6975
|
-
return withErrorHandling(tool2, "Error publishing template");
|
|
7115
|
+
return withErrorHandling(tool2, "Error publishing experience template");
|
|
6976
7116
|
}
|
|
6977
7117
|
|
|
6978
|
-
// src/tools/exo/templates/
|
|
6979
|
-
import { z as
|
|
6980
|
-
var
|
|
6981
|
-
|
|
6982
|
-
version:
|
|
6983
|
-
"REQUIRED. The template's sys.version as returned by
|
|
7118
|
+
// src/tools/exo/experience-templates/unpublishExperienceTemplate.ts
|
|
7119
|
+
import { z as z105 } from "zod";
|
|
7120
|
+
var UnpublishExperienceTemplateToolParams = BaseToolSchema.extend({
|
|
7121
|
+
experienceTemplateId: z105.string().describe("The ID of the experience template to unpublish"),
|
|
7122
|
+
version: z105.number().describe(
|
|
7123
|
+
"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
7124
|
)
|
|
6985
7125
|
});
|
|
6986
|
-
function
|
|
7126
|
+
function unpublishExperienceTemplateTool(config) {
|
|
6987
7127
|
async function tool2(args) {
|
|
6988
7128
|
assertEnvironmentNotProtected(
|
|
6989
7129
|
args.environmentId,
|
|
@@ -6992,125 +7132,128 @@ function unpublishTemplateTool(config) {
|
|
|
6992
7132
|
const params = {
|
|
6993
7133
|
spaceId: args.spaceId,
|
|
6994
7134
|
environmentId: args.environmentId,
|
|
6995
|
-
|
|
7135
|
+
experienceTemplateId: args.experienceTemplateId
|
|
6996
7136
|
};
|
|
6997
7137
|
const contentfulClient = createToolClient(config, args);
|
|
6998
|
-
const current = await contentfulClient.
|
|
7138
|
+
const current = await contentfulClient.experienceTemplate.get(params);
|
|
6999
7139
|
if (args.version !== current.sys.version) {
|
|
7000
7140
|
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
|
|
7141
|
+
`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
7142
|
);
|
|
7003
7143
|
}
|
|
7004
|
-
const
|
|
7144
|
+
const experienceTemplate = await contentfulClient.experienceTemplate.unpublish({
|
|
7005
7145
|
...params,
|
|
7006
7146
|
version: args.version
|
|
7007
7147
|
});
|
|
7008
|
-
return createSuccessResponse(
|
|
7009
|
-
template
|
|
7010
|
-
|
|
7148
|
+
return createSuccessResponse(
|
|
7149
|
+
"Experience template unpublished successfully",
|
|
7150
|
+
{
|
|
7151
|
+
experienceTemplate
|
|
7152
|
+
}
|
|
7153
|
+
);
|
|
7011
7154
|
}
|
|
7012
|
-
return withErrorHandling(tool2, "Error unpublishing template");
|
|
7155
|
+
return withErrorHandling(tool2, "Error unpublishing experience template");
|
|
7013
7156
|
}
|
|
7014
7157
|
|
|
7015
|
-
// src/tools/exo/templates/register.ts
|
|
7016
|
-
function
|
|
7017
|
-
const
|
|
7018
|
-
const
|
|
7019
|
-
const
|
|
7020
|
-
const
|
|
7021
|
-
const
|
|
7022
|
-
const
|
|
7023
|
-
const
|
|
7158
|
+
// src/tools/exo/experience-templates/register.ts
|
|
7159
|
+
function createExperienceTemplateTools(config) {
|
|
7160
|
+
const getExperienceTemplate = getExperienceTemplateTool(config);
|
|
7161
|
+
const listExperienceTemplates = listExperienceTemplatesTool(config);
|
|
7162
|
+
const createExperienceTemplate = createExperienceTemplateTool(config);
|
|
7163
|
+
const upsertExperienceTemplate = upsertExperienceTemplateTool(config);
|
|
7164
|
+
const deleteExperienceTemplate = deleteExperienceTemplateTool(config);
|
|
7165
|
+
const publishExperienceTemplate = publishExperienceTemplateTool(config);
|
|
7166
|
+
const unpublishExperienceTemplate = unpublishExperienceTemplateTool(config);
|
|
7024
7167
|
return {
|
|
7025
|
-
|
|
7026
|
-
title: "
|
|
7027
|
-
description: "Get details about a specific ExO template (a layout definition that backs template-based Experiences).",
|
|
7028
|
-
inputParams:
|
|
7168
|
+
getExperienceTemplate: {
|
|
7169
|
+
title: "get_experience_template",
|
|
7170
|
+
description: "Get details about a specific ExO experience template (a layout definition that backs experience-template-based Experiences).",
|
|
7171
|
+
inputParams: GetExperienceTemplateToolParams.shape,
|
|
7029
7172
|
annotations: {
|
|
7030
7173
|
readOnlyHint: true,
|
|
7031
7174
|
destructiveHint: false,
|
|
7032
7175
|
openWorldHint: false
|
|
7033
7176
|
},
|
|
7034
|
-
tool:
|
|
7177
|
+
tool: getExperienceTemplate
|
|
7035
7178
|
},
|
|
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:
|
|
7179
|
+
listExperienceTemplates: {
|
|
7180
|
+
title: "list_experience_templates",
|
|
7181
|
+
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.",
|
|
7182
|
+
inputParams: ListExperienceTemplatesToolParams.shape,
|
|
7040
7183
|
annotations: {
|
|
7041
7184
|
readOnlyHint: true,
|
|
7042
7185
|
destructiveHint: false,
|
|
7043
7186
|
openWorldHint: false
|
|
7044
7187
|
},
|
|
7045
|
-
tool:
|
|
7188
|
+
tool: listExperienceTemplates
|
|
7046
7189
|
},
|
|
7047
|
-
|
|
7048
|
-
title: "
|
|
7049
|
-
description: "Create a new ExO template.",
|
|
7050
|
-
inputParams:
|
|
7190
|
+
createExperienceTemplate: {
|
|
7191
|
+
title: "create_experience_template",
|
|
7192
|
+
description: "Create a new ExO experience template.",
|
|
7193
|
+
inputParams: CreateExperienceTemplateToolParams.shape,
|
|
7051
7194
|
annotations: {
|
|
7052
7195
|
readOnlyHint: false,
|
|
7053
7196
|
destructiveHint: false,
|
|
7054
7197
|
idempotentHint: false,
|
|
7055
7198
|
openWorldHint: false
|
|
7056
7199
|
},
|
|
7057
|
-
tool:
|
|
7200
|
+
tool: createExperienceTemplate
|
|
7058
7201
|
},
|
|
7059
|
-
|
|
7060
|
-
title: "
|
|
7061
|
-
description: "Update an existing ExO template. You MUST call
|
|
7062
|
-
inputParams:
|
|
7202
|
+
upsertExperienceTemplate: {
|
|
7203
|
+
title: "upsert_experience_template",
|
|
7204
|
+
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.",
|
|
7205
|
+
inputParams: UpsertExperienceTemplateToolParams.shape,
|
|
7063
7206
|
annotations: {
|
|
7064
7207
|
readOnlyHint: false,
|
|
7065
7208
|
destructiveHint: false,
|
|
7066
7209
|
idempotentHint: false,
|
|
7067
7210
|
openWorldHint: false
|
|
7068
7211
|
},
|
|
7069
|
-
tool:
|
|
7212
|
+
tool: upsertExperienceTemplate
|
|
7070
7213
|
},
|
|
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:
|
|
7214
|
+
deleteExperienceTemplate: {
|
|
7215
|
+
title: "delete_experience_template",
|
|
7216
|
+
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.",
|
|
7217
|
+
inputParams: DeleteExperienceTemplateToolParams.shape,
|
|
7075
7218
|
annotations: {
|
|
7076
7219
|
readOnlyHint: false,
|
|
7077
7220
|
destructiveHint: true,
|
|
7078
7221
|
idempotentHint: false,
|
|
7079
7222
|
openWorldHint: false
|
|
7080
7223
|
},
|
|
7081
|
-
tool:
|
|
7224
|
+
tool: deleteExperienceTemplate
|
|
7082
7225
|
},
|
|
7083
|
-
|
|
7084
|
-
title: "
|
|
7085
|
-
description: "Publish an ExO template. You MUST call
|
|
7086
|
-
inputParams:
|
|
7226
|
+
publishExperienceTemplate: {
|
|
7227
|
+
title: "publish_experience_template",
|
|
7228
|
+
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.",
|
|
7229
|
+
inputParams: PublishExperienceTemplateToolParams.shape,
|
|
7087
7230
|
annotations: {
|
|
7088
7231
|
readOnlyHint: false,
|
|
7089
7232
|
destructiveHint: true,
|
|
7090
7233
|
idempotentHint: true,
|
|
7091
7234
|
openWorldHint: false
|
|
7092
7235
|
},
|
|
7093
|
-
tool:
|
|
7236
|
+
tool: publishExperienceTemplate
|
|
7094
7237
|
},
|
|
7095
|
-
|
|
7096
|
-
title: "
|
|
7097
|
-
description: "Unpublish an ExO template. You MUST call
|
|
7098
|
-
inputParams:
|
|
7238
|
+
unpublishExperienceTemplate: {
|
|
7239
|
+
title: "unpublish_experience_template",
|
|
7240
|
+
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.",
|
|
7241
|
+
inputParams: UnpublishExperienceTemplateToolParams.shape,
|
|
7099
7242
|
annotations: {
|
|
7100
7243
|
readOnlyHint: false,
|
|
7101
7244
|
destructiveHint: true,
|
|
7102
7245
|
idempotentHint: true,
|
|
7103
7246
|
openWorldHint: false
|
|
7104
7247
|
},
|
|
7105
|
-
tool:
|
|
7248
|
+
tool: unpublishExperienceTemplate
|
|
7106
7249
|
}
|
|
7107
7250
|
};
|
|
7108
7251
|
}
|
|
7109
7252
|
|
|
7110
7253
|
// src/tools/exo/experiences/getExperience.ts
|
|
7111
|
-
import { z as
|
|
7254
|
+
import { z as z106 } from "zod";
|
|
7112
7255
|
var GetExperienceToolParams = BaseToolSchema.extend({
|
|
7113
|
-
experienceId:
|
|
7256
|
+
experienceId: z106.string().describe("The ID of the experience to retrieve")
|
|
7114
7257
|
});
|
|
7115
7258
|
function getExperienceTool(config) {
|
|
7116
7259
|
async function tool2(args) {
|
|
@@ -7128,12 +7271,12 @@ function getExperienceTool(config) {
|
|
|
7128
7271
|
}
|
|
7129
7272
|
|
|
7130
7273
|
// src/tools/exo/experiences/listExperiences.ts
|
|
7131
|
-
import { z as
|
|
7274
|
+
import { z as z107 } from "zod";
|
|
7132
7275
|
var ListExperiencesToolParams = BaseToolSchema.extend({
|
|
7133
|
-
limit:
|
|
7134
|
-
pageNext:
|
|
7135
|
-
pagePrev:
|
|
7136
|
-
order:
|
|
7276
|
+
limit: z107.number().optional().describe("Maximum number of experiences to return (max 10)"),
|
|
7277
|
+
pageNext: z107.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
7278
|
+
pagePrev: z107.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
7279
|
+
order: z107.string().optional().describe("Order experiences by this field (e.g. sys.createdAt)")
|
|
7137
7280
|
});
|
|
7138
7281
|
function listExperiencesTool(config) {
|
|
7139
7282
|
async function tool2(args) {
|
|
@@ -7163,29 +7306,22 @@ function listExperiencesTool(config) {
|
|
|
7163
7306
|
}
|
|
7164
7307
|
|
|
7165
7308
|
// src/tools/exo/experiences/createExperience.ts
|
|
7166
|
-
import { z as
|
|
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
|
-
});
|
|
7309
|
+
import { z as z108 } from "zod";
|
|
7174
7310
|
var CreateExperienceToolParams = BaseToolSchema.extend({
|
|
7175
|
-
name:
|
|
7176
|
-
description:
|
|
7177
|
-
|
|
7178
|
-
"Resource link to the
|
|
7311
|
+
name: z108.string().describe("The name of the experience"),
|
|
7312
|
+
description: z108.string().describe("Description of the experience"),
|
|
7313
|
+
experienceTemplate: ExperienceTemplateResourceLinkSchema.describe(
|
|
7314
|
+
"Resource link to the ExperienceTemplate this experience is backed by"
|
|
7179
7315
|
),
|
|
7180
|
-
viewports:
|
|
7181
|
-
designProperties:
|
|
7316
|
+
viewports: z108.array(ViewportSchema).describe("Viewport definitions for the experience (may be empty)"),
|
|
7317
|
+
designProperties: z108.record(z108.string(), DimensionedDesignPropertyValueSchema).describe(
|
|
7182
7318
|
"Design property values keyed by property ID. Each value is a dimensioned map (viewport ID \u2192 design value). May be an empty object."
|
|
7183
7319
|
),
|
|
7184
7320
|
contentBindings: ExperienceContentBindingsSchema.optional().describe(
|
|
7185
7321
|
"Optional content bindings linking this experience to a data assembly"
|
|
7186
7322
|
),
|
|
7187
|
-
slots:
|
|
7188
|
-
"Optional slot contents keyed by slot ID. Each value is an array of
|
|
7323
|
+
slots: z108.record(z108.string(), z108.array(ExperienceSlotNodeSchema)).optional().describe(
|
|
7324
|
+
"Optional slot contents keyed by slot ID. Each value is an array of ExperienceFragmentNode or InlineExperienceFragmentNode."
|
|
7189
7325
|
),
|
|
7190
7326
|
metadata: ExperienceMetadataSchema.optional().describe(
|
|
7191
7327
|
"Optional ExO metadata (tags, concepts)"
|
|
@@ -7203,7 +7339,7 @@ function createExperienceTool(config) {
|
|
|
7203
7339
|
{
|
|
7204
7340
|
name: args.name,
|
|
7205
7341
|
description: args.description,
|
|
7206
|
-
|
|
7342
|
+
experienceTemplate: args.experienceTemplate,
|
|
7207
7343
|
viewports: args.viewports,
|
|
7208
7344
|
designProperties: args.designProperties,
|
|
7209
7345
|
...args.contentBindings && { contentBindings: args.contentBindings },
|
|
@@ -7219,24 +7355,22 @@ function createExperienceTool(config) {
|
|
|
7219
7355
|
}
|
|
7220
7356
|
|
|
7221
7357
|
// src/tools/exo/experiences/upsertExperience.ts
|
|
7222
|
-
import { z as
|
|
7358
|
+
import { z as z109 } from "zod";
|
|
7223
7359
|
var UpsertExperienceToolParams = BaseToolSchema.extend({
|
|
7224
|
-
experienceId:
|
|
7225
|
-
version:
|
|
7360
|
+
experienceId: z109.string().describe("The ID of the experience to update"),
|
|
7361
|
+
version: z109.number().describe(
|
|
7226
7362
|
"REQUIRED. The experience's sys.version as returned by get_experience. You must call get_experience first to read the current state and version. The update is rejected if this does not match the current version, which means the experience changed since you read it."
|
|
7227
7363
|
),
|
|
7228
|
-
name:
|
|
7229
|
-
description:
|
|
7230
|
-
viewports:
|
|
7231
|
-
designProperties:
|
|
7364
|
+
name: z109.string().optional().describe("The name of the experience"),
|
|
7365
|
+
description: z109.string().optional().describe("Description of the experience"),
|
|
7366
|
+
viewports: z109.array(ViewportSchema).optional().describe("Viewport definitions; replaces existing viewports if provided"),
|
|
7367
|
+
designProperties: z109.record(z109.string(), DimensionedDesignPropertyValueSchema).optional().describe(
|
|
7232
7368
|
"Design property values keyed by property ID; replaces existing if provided"
|
|
7233
7369
|
),
|
|
7234
7370
|
contentBindings: ExperienceContentBindingsSchema.optional().describe(
|
|
7235
7371
|
"Content bindings linking this experience to a data assembly; replaces existing if provided"
|
|
7236
7372
|
),
|
|
7237
|
-
slots:
|
|
7238
|
-
"Slot contents keyed by slot ID; replaces existing if provided"
|
|
7239
|
-
),
|
|
7373
|
+
slots: z109.record(z109.string(), z109.array(ExperienceSlotNodeSchema)).optional().describe("Slot contents keyed by slot ID; replaces existing if provided"),
|
|
7240
7374
|
metadata: ExperienceMetadataSchema.optional().describe(
|
|
7241
7375
|
"ExO metadata (tags, concepts); replaces existing if provided"
|
|
7242
7376
|
)
|
|
@@ -7281,13 +7415,13 @@ function upsertExperienceTool(config) {
|
|
|
7281
7415
|
}
|
|
7282
7416
|
|
|
7283
7417
|
// src/tools/exo/experiences/deleteExperience.ts
|
|
7284
|
-
import { z as
|
|
7418
|
+
import { z as z110 } from "zod";
|
|
7285
7419
|
var DeleteExperienceToolParams = BaseToolSchema.extend({
|
|
7286
|
-
experienceId:
|
|
7287
|
-
confirm:
|
|
7420
|
+
experienceId: z110.string().describe("The ID of the experience to delete"),
|
|
7421
|
+
confirm: z110.boolean().optional().describe(
|
|
7288
7422
|
"Set to true on the second call to actually perform the deletion. Required together with confirmToken."
|
|
7289
7423
|
),
|
|
7290
|
-
confirmToken:
|
|
7424
|
+
confirmToken: z110.string().optional().describe(
|
|
7291
7425
|
"Token returned by the preview call; must be supplied with confirm: true."
|
|
7292
7426
|
)
|
|
7293
7427
|
});
|
|
@@ -7329,10 +7463,10 @@ function deleteExperienceTool(config) {
|
|
|
7329
7463
|
}
|
|
7330
7464
|
|
|
7331
7465
|
// src/tools/exo/experiences/publishExperience.ts
|
|
7332
|
-
import { z as
|
|
7466
|
+
import { z as z111 } from "zod";
|
|
7333
7467
|
var PublishExperienceToolParams = BaseToolSchema.extend({
|
|
7334
|
-
experienceId:
|
|
7335
|
-
version:
|
|
7468
|
+
experienceId: z111.string().describe("The ID of the experience to publish"),
|
|
7469
|
+
version: z111.number().describe(
|
|
7336
7470
|
"REQUIRED. The experience's sys.version as returned by get_experience. You must call get_experience first to read the current state and version. The publish is rejected if this does not match the current version, which means the experience changed since you read it."
|
|
7337
7471
|
)
|
|
7338
7472
|
});
|
|
@@ -7366,10 +7500,10 @@ function publishExperienceTool(config) {
|
|
|
7366
7500
|
}
|
|
7367
7501
|
|
|
7368
7502
|
// src/tools/exo/experiences/unpublishExperience.ts
|
|
7369
|
-
import { z as
|
|
7503
|
+
import { z as z112 } from "zod";
|
|
7370
7504
|
var UnpublishExperienceToolParams = BaseToolSchema.extend({
|
|
7371
|
-
experienceId:
|
|
7372
|
-
version:
|
|
7505
|
+
experienceId: z112.string().describe("The ID of the experience to unpublish"),
|
|
7506
|
+
version: z112.number().describe(
|
|
7373
7507
|
"REQUIRED. The experience's sys.version as returned by get_experience. You must call get_experience first to read the current state and version. The unpublish is rejected if this does not match the current version, which means the experience changed since you read it."
|
|
7374
7508
|
)
|
|
7375
7509
|
});
|
|
@@ -7414,7 +7548,7 @@ function createExperienceTools(config) {
|
|
|
7414
7548
|
return {
|
|
7415
7549
|
getExperience: {
|
|
7416
7550
|
title: "get_experience",
|
|
7417
|
-
description: "Get details about a specific ExO experience (a concrete page or screen that composes a root
|
|
7551
|
+
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
7552
|
inputParams: GetExperienceToolParams.shape,
|
|
7419
7553
|
annotations: {
|
|
7420
7554
|
readOnlyHint: true,
|
|
@@ -7436,7 +7570,7 @@ function createExperienceTools(config) {
|
|
|
7436
7570
|
},
|
|
7437
7571
|
createExperience: {
|
|
7438
7572
|
title: "create_experience",
|
|
7439
|
-
description: "Create a new ExO experience backed by
|
|
7573
|
+
description: "Create a new ExO experience backed by an ExperienceTemplate.",
|
|
7440
7574
|
inputParams: CreateExperienceToolParams.shape,
|
|
7441
7575
|
annotations: {
|
|
7442
7576
|
readOnlyHint: false,
|
|
@@ -7498,9 +7632,9 @@ function createExperienceTools(config) {
|
|
|
7498
7632
|
}
|
|
7499
7633
|
|
|
7500
7634
|
// src/tools/exo/data-assemblies/getDataAssembly.ts
|
|
7501
|
-
import { z as
|
|
7635
|
+
import { z as z113 } from "zod";
|
|
7502
7636
|
var GetDataAssemblyToolParams = BaseToolSchema.extend({
|
|
7503
|
-
dataAssemblyId:
|
|
7637
|
+
dataAssemblyId: z113.string().describe("The ID of the data assembly to retrieve")
|
|
7504
7638
|
});
|
|
7505
7639
|
function getDataAssemblyTool(config) {
|
|
7506
7640
|
async function tool2(args) {
|
|
@@ -7518,9 +7652,9 @@ function getDataAssemblyTool(config) {
|
|
|
7518
7652
|
}
|
|
7519
7653
|
|
|
7520
7654
|
// src/tools/exo/data-assemblies/getPublishedDataAssembly.ts
|
|
7521
|
-
import { z as
|
|
7655
|
+
import { z as z114 } from "zod";
|
|
7522
7656
|
var GetPublishedDataAssemblyToolParams = BaseToolSchema.extend({
|
|
7523
|
-
dataAssemblyId:
|
|
7657
|
+
dataAssemblyId: z114.string().describe("The ID of the published data assembly to retrieve")
|
|
7524
7658
|
});
|
|
7525
7659
|
function getPublishedDataAssemblyTool(config) {
|
|
7526
7660
|
async function tool2(args) {
|
|
@@ -7538,12 +7672,12 @@ function getPublishedDataAssemblyTool(config) {
|
|
|
7538
7672
|
}
|
|
7539
7673
|
|
|
7540
7674
|
// src/tools/exo/data-assemblies/listDataAssemblies.ts
|
|
7541
|
-
import { z as
|
|
7675
|
+
import { z as z115 } from "zod";
|
|
7542
7676
|
var ListDataAssembliesToolParams = BaseToolSchema.extend({
|
|
7543
|
-
limit:
|
|
7544
|
-
pageNext:
|
|
7545
|
-
pagePrev:
|
|
7546
|
-
sysIdIn:
|
|
7677
|
+
limit: z115.number().optional().describe("Maximum number of data assemblies to return (max 10)"),
|
|
7678
|
+
pageNext: z115.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
7679
|
+
pagePrev: z115.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
7680
|
+
sysIdIn: z115.string().optional().describe("Comma-separated list of data assembly IDs to filter by")
|
|
7547
7681
|
});
|
|
7548
7682
|
function listDataAssembliesTool(config) {
|
|
7549
7683
|
async function tool2(args) {
|
|
@@ -7572,12 +7706,12 @@ function listDataAssembliesTool(config) {
|
|
|
7572
7706
|
}
|
|
7573
7707
|
|
|
7574
7708
|
// src/tools/exo/data-assemblies/listPublishedDataAssemblies.ts
|
|
7575
|
-
import { z as
|
|
7709
|
+
import { z as z116 } from "zod";
|
|
7576
7710
|
var ListPublishedDataAssembliesToolParams = BaseToolSchema.extend({
|
|
7577
|
-
limit:
|
|
7578
|
-
pageNext:
|
|
7579
|
-
pagePrev:
|
|
7580
|
-
sysIdIn:
|
|
7711
|
+
limit: z116.number().optional().describe("Maximum number of published data assemblies to return (max 10)"),
|
|
7712
|
+
pageNext: z116.string().optional().describe("Cursor token to fetch the next page of results"),
|
|
7713
|
+
pagePrev: z116.string().optional().describe("Cursor token to fetch the previous page of results"),
|
|
7714
|
+
sysIdIn: z116.string().optional().describe("Comma-separated list of data assembly IDs to filter by")
|
|
7581
7715
|
});
|
|
7582
7716
|
function listPublishedDataAssembliesTool(config) {
|
|
7583
7717
|
async function tool2(args) {
|
|
@@ -7606,35 +7740,35 @@ function listPublishedDataAssembliesTool(config) {
|
|
|
7606
7740
|
}
|
|
7607
7741
|
|
|
7608
7742
|
// src/tools/exo/data-assemblies/createDataAssembly.ts
|
|
7609
|
-
import { z as
|
|
7743
|
+
import { z as z118 } from "zod";
|
|
7610
7744
|
|
|
7611
7745
|
// src/types/dataAssemblySchemas.ts
|
|
7612
|
-
import { z as
|
|
7613
|
-
var PointerExpressionValueSchema =
|
|
7614
|
-
() =>
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
$from:
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
source:
|
|
7746
|
+
import { z as z117 } from "zod";
|
|
7747
|
+
var PointerExpressionValueSchema = z117.lazy(
|
|
7748
|
+
() => z117.union([
|
|
7749
|
+
z117.string(),
|
|
7750
|
+
z117.object({
|
|
7751
|
+
$from: z117.union([
|
|
7752
|
+
z117.string(),
|
|
7753
|
+
z117.object({
|
|
7754
|
+
source: z117.string(),
|
|
7621
7755
|
select: PointerExpressionValueSchema.optional()
|
|
7622
7756
|
})
|
|
7623
7757
|
])
|
|
7624
7758
|
}),
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
$on:
|
|
7629
|
-
type:
|
|
7759
|
+
z117.object({ $literal: z117.custom() }),
|
|
7760
|
+
z117.object({ $object: z117.record(z117.string(), PointerExpressionValueSchema) }),
|
|
7761
|
+
z117.object({
|
|
7762
|
+
$on: z117.object({
|
|
7763
|
+
type: z117.record(z117.string(), PointerExpressionValueSchema),
|
|
7630
7764
|
default: PointerExpressionValueSchema.optional()
|
|
7631
7765
|
})
|
|
7632
7766
|
}),
|
|
7633
|
-
|
|
7767
|
+
z117.record(z117.string(), PointerExpressionValueSchema)
|
|
7634
7768
|
])
|
|
7635
7769
|
);
|
|
7636
|
-
var CanonicalDataTypeArmSchema =
|
|
7637
|
-
type:
|
|
7770
|
+
var CanonicalDataTypeArmSchema = z117.object({
|
|
7771
|
+
type: z117.enum([
|
|
7638
7772
|
"String",
|
|
7639
7773
|
"Number",
|
|
7640
7774
|
"Integer",
|
|
@@ -7646,72 +7780,72 @@ var CanonicalDataTypeArmSchema = z116.object({
|
|
|
7646
7780
|
"Literal",
|
|
7647
7781
|
"DiscriminatedUnion"
|
|
7648
7782
|
]),
|
|
7649
|
-
id:
|
|
7650
|
-
name:
|
|
7651
|
-
required:
|
|
7652
|
-
}).catchall(
|
|
7653
|
-
var LegacyDataTypeArmSchema =
|
|
7654
|
-
id:
|
|
7655
|
-
name:
|
|
7656
|
-
type:
|
|
7657
|
-
required:
|
|
7658
|
-
source:
|
|
7659
|
-
ref:
|
|
7660
|
-
});
|
|
7661
|
-
var DataAssemblyDataTypeFieldSchema =
|
|
7783
|
+
id: z117.string().describe("Data type field identifier"),
|
|
7784
|
+
name: z117.string().describe("Human-readable name"),
|
|
7785
|
+
required: z117.boolean().optional()
|
|
7786
|
+
}).catchall(z117.unknown());
|
|
7787
|
+
var LegacyDataTypeArmSchema = z117.object({
|
|
7788
|
+
id: z117.string().describe("Data type field identifier"),
|
|
7789
|
+
name: z117.string().describe("Human-readable name"),
|
|
7790
|
+
type: z117.string(),
|
|
7791
|
+
required: z117.boolean().optional(),
|
|
7792
|
+
source: z117.string().optional(),
|
|
7793
|
+
ref: z117.unknown().optional()
|
|
7794
|
+
});
|
|
7795
|
+
var DataAssemblyDataTypeFieldSchema = z117.union([
|
|
7662
7796
|
CanonicalDataTypeArmSchema,
|
|
7663
7797
|
LegacyDataTypeArmSchema
|
|
7664
7798
|
]);
|
|
7665
7799
|
var SAME_SPACE_CONTENT_SOURCE = "crn:contentful:::content:spaces/$self/environments/$self";
|
|
7666
|
-
var DataAssemblyResourceLinkParameterSchema =
|
|
7667
|
-
name:
|
|
7668
|
-
description:
|
|
7669
|
-
type:
|
|
7670
|
-
linkType:
|
|
7671
|
-
allowedResources:
|
|
7672
|
-
|
|
7673
|
-
type:
|
|
7674
|
-
source:
|
|
7675
|
-
allowedTypes:
|
|
7800
|
+
var DataAssemblyResourceLinkParameterSchema = z117.object({
|
|
7801
|
+
name: z117.string().optional(),
|
|
7802
|
+
description: z117.string().optional(),
|
|
7803
|
+
type: z117.literal("ResourceLink"),
|
|
7804
|
+
linkType: z117.literal("Contentful:Entry"),
|
|
7805
|
+
allowedResources: z117.array(
|
|
7806
|
+
z117.object({
|
|
7807
|
+
type: z117.literal("Contentful:Entry"),
|
|
7808
|
+
source: z117.literal(SAME_SPACE_CONTENT_SOURCE),
|
|
7809
|
+
allowedTypes: z117.array(z117.string())
|
|
7676
7810
|
})
|
|
7677
7811
|
)
|
|
7678
7812
|
});
|
|
7679
|
-
var DataAssemblyParameterConfigSchema =
|
|
7680
|
-
|
|
7813
|
+
var DataAssemblyParameterConfigSchema = z117.record(
|
|
7814
|
+
z117.string(),
|
|
7681
7815
|
DataAssemblyResourceLinkParameterSchema
|
|
7682
7816
|
);
|
|
7683
|
-
var DataAssemblyGraphQLResolverSchema =
|
|
7684
|
-
source:
|
|
7685
|
-
query:
|
|
7817
|
+
var DataAssemblyGraphQLResolverSchema = z117.object({
|
|
7818
|
+
source: z117.literal("Contentful:GraphQL"),
|
|
7819
|
+
query: z117.string().describe("GraphQL query string"),
|
|
7686
7820
|
parameters: PointerExpressionValueSchema.optional()
|
|
7687
7821
|
});
|
|
7688
|
-
var DataAssemblyNestedResolverSchema =
|
|
7689
|
-
source:
|
|
7690
|
-
dataAssembly:
|
|
7691
|
-
sys:
|
|
7692
|
-
type:
|
|
7693
|
-
linkType:
|
|
7694
|
-
urn:
|
|
7822
|
+
var DataAssemblyNestedResolverSchema = z117.object({
|
|
7823
|
+
source: z117.literal("Contentful:DataAssembly"),
|
|
7824
|
+
dataAssembly: z117.object({
|
|
7825
|
+
sys: z117.object({
|
|
7826
|
+
type: z117.literal("ResourceLink"),
|
|
7827
|
+
linkType: z117.literal("Contentful:DataAssembly"),
|
|
7828
|
+
urn: z117.string()
|
|
7695
7829
|
})
|
|
7696
7830
|
}),
|
|
7697
7831
|
parameters: PointerExpressionValueSchema.optional()
|
|
7698
7832
|
});
|
|
7699
|
-
var DataAssemblyResolverDefinitionSchema =
|
|
7833
|
+
var DataAssemblyResolverDefinitionSchema = z117.union([
|
|
7700
7834
|
DataAssemblyGraphQLResolverSchema,
|
|
7701
7835
|
DataAssemblyNestedResolverSchema
|
|
7702
7836
|
]);
|
|
7703
|
-
var DataAssemblyResolverConfigSchema =
|
|
7704
|
-
|
|
7837
|
+
var DataAssemblyResolverConfigSchema = z117.record(
|
|
7838
|
+
z117.string(),
|
|
7705
7839
|
DataAssemblyResolverDefinitionSchema
|
|
7706
7840
|
);
|
|
7707
7841
|
var DataAssemblyReturnMappingConfigSchema = PointerExpressionValueSchema;
|
|
7708
|
-
var DataAssemblyMetadataSchema =
|
|
7709
|
-
tags:
|
|
7710
|
-
|
|
7711
|
-
sys:
|
|
7712
|
-
type:
|
|
7713
|
-
linkType:
|
|
7714
|
-
id:
|
|
7842
|
+
var DataAssemblyMetadataSchema = z117.object({
|
|
7843
|
+
tags: z117.array(
|
|
7844
|
+
z117.object({
|
|
7845
|
+
sys: z117.object({
|
|
7846
|
+
type: z117.literal("Link"),
|
|
7847
|
+
linkType: z117.literal("Tag"),
|
|
7848
|
+
id: z117.string()
|
|
7715
7849
|
})
|
|
7716
7850
|
})
|
|
7717
7851
|
)
|
|
@@ -7719,8 +7853,8 @@ var DataAssemblyMetadataSchema = z116.object({
|
|
|
7719
7853
|
|
|
7720
7854
|
// src/tools/exo/data-assemblies/createDataAssembly.ts
|
|
7721
7855
|
var CreateDataAssemblyToolParams = BaseToolSchema.extend({
|
|
7722
|
-
name:
|
|
7723
|
-
description:
|
|
7856
|
+
name: z118.string().describe("The name of the data assembly"),
|
|
7857
|
+
description: z118.string().describe("Description of the data assembly"),
|
|
7724
7858
|
parameters: DataAssemblyParameterConfigSchema.describe(
|
|
7725
7859
|
"Parameter definitions keyed by parameter name (may be empty object)"
|
|
7726
7860
|
),
|
|
@@ -7730,8 +7864,8 @@ var CreateDataAssemblyToolParams = BaseToolSchema.extend({
|
|
|
7730
7864
|
return: DataAssemblyReturnMappingConfigSchema.describe(
|
|
7731
7865
|
"Return mapping configuration specifying how to map resolved data"
|
|
7732
7866
|
),
|
|
7733
|
-
dataType:
|
|
7734
|
-
variant:
|
|
7867
|
+
dataType: z118.array(DataAssemblyDataTypeFieldSchema).describe("Data type field definitions for this data assembly (may be empty array)"),
|
|
7868
|
+
variant: z118.string().optional().describe("Optional variant identifier for this data assembly"),
|
|
7735
7869
|
metadata: DataAssemblyMetadataSchema.optional().describe("Optional metadata (tags)")
|
|
7736
7870
|
});
|
|
7737
7871
|
function createDataAssemblyTool(config) {
|
|
@@ -7765,14 +7899,14 @@ function createDataAssemblyTool(config) {
|
|
|
7765
7899
|
}
|
|
7766
7900
|
|
|
7767
7901
|
// src/tools/exo/data-assemblies/updateDataAssembly.ts
|
|
7768
|
-
import { z as
|
|
7902
|
+
import { z as z119 } from "zod";
|
|
7769
7903
|
var UpdateDataAssemblyToolParams = BaseToolSchema.extend({
|
|
7770
|
-
dataAssemblyId:
|
|
7771
|
-
version:
|
|
7904
|
+
dataAssemblyId: z119.string().describe("The ID of the data assembly to update"),
|
|
7905
|
+
version: z119.number().describe(
|
|
7772
7906
|
"REQUIRED. The data assembly's sys.version as returned by get_data_assembly. You must call get_data_assembly first to read the current state and version. The update is rejected if this does not match the current version, which means the data assembly changed since you read it."
|
|
7773
7907
|
),
|
|
7774
|
-
name:
|
|
7775
|
-
description:
|
|
7908
|
+
name: z119.string().optional().describe("The name of the data assembly"),
|
|
7909
|
+
description: z119.string().optional().describe("Description of the data assembly"),
|
|
7776
7910
|
parameters: DataAssemblyParameterConfigSchema.optional().describe(
|
|
7777
7911
|
"Parameter definitions; replaces existing if provided"
|
|
7778
7912
|
),
|
|
@@ -7782,8 +7916,8 @@ var UpdateDataAssemblyToolParams = BaseToolSchema.extend({
|
|
|
7782
7916
|
return: DataAssemblyReturnMappingConfigSchema.optional().describe(
|
|
7783
7917
|
"Return mapping configuration; replaces existing if provided"
|
|
7784
7918
|
),
|
|
7785
|
-
dataType:
|
|
7786
|
-
variant:
|
|
7919
|
+
dataType: z119.array(DataAssemblyDataTypeFieldSchema).optional().describe("Data type field definitions; replaces existing if provided"),
|
|
7920
|
+
variant: z119.string().optional().describe("Optional variant identifier; replaces existing if provided"),
|
|
7787
7921
|
metadata: DataAssemblyMetadataSchema.optional().describe(
|
|
7788
7922
|
"Metadata (tags); replaces existing if provided"
|
|
7789
7923
|
)
|
|
@@ -7829,13 +7963,13 @@ function updateDataAssemblyTool(config) {
|
|
|
7829
7963
|
}
|
|
7830
7964
|
|
|
7831
7965
|
// src/tools/exo/data-assemblies/deleteDataAssembly.ts
|
|
7832
|
-
import { z as
|
|
7966
|
+
import { z as z120 } from "zod";
|
|
7833
7967
|
var DeleteDataAssemblyToolParams = BaseToolSchema.extend({
|
|
7834
|
-
dataAssemblyId:
|
|
7835
|
-
confirm:
|
|
7968
|
+
dataAssemblyId: z120.string().describe("The ID of the data assembly to delete"),
|
|
7969
|
+
confirm: z120.boolean().optional().describe(
|
|
7836
7970
|
"Set to true on the second call to actually perform the deletion. Required together with confirmToken."
|
|
7837
7971
|
),
|
|
7838
|
-
confirmToken:
|
|
7972
|
+
confirmToken: z120.string().optional().describe(
|
|
7839
7973
|
"Token returned by the preview call; must be supplied with confirm: true."
|
|
7840
7974
|
)
|
|
7841
7975
|
});
|
|
@@ -7877,10 +8011,10 @@ function deleteDataAssemblyTool(config) {
|
|
|
7877
8011
|
}
|
|
7878
8012
|
|
|
7879
8013
|
// src/tools/exo/data-assemblies/publishDataAssembly.ts
|
|
7880
|
-
import { z as
|
|
8014
|
+
import { z as z121 } from "zod";
|
|
7881
8015
|
var PublishDataAssemblyToolParams = BaseToolSchema.extend({
|
|
7882
|
-
dataAssemblyId:
|
|
7883
|
-
version:
|
|
8016
|
+
dataAssemblyId: z121.string().describe("The ID of the data assembly to publish"),
|
|
8017
|
+
version: z121.number().describe(
|
|
7884
8018
|
"REQUIRED. The data assembly's sys.version as returned by get_data_assembly. You must call get_data_assembly first to read the current state and version. The publish is rejected if this does not match the current version, which means the data assembly changed since you read it."
|
|
7885
8019
|
)
|
|
7886
8020
|
});
|
|
@@ -7914,10 +8048,10 @@ function publishDataAssemblyTool(config) {
|
|
|
7914
8048
|
}
|
|
7915
8049
|
|
|
7916
8050
|
// src/tools/exo/data-assemblies/unpublishDataAssembly.ts
|
|
7917
|
-
import { z as
|
|
8051
|
+
import { z as z122 } from "zod";
|
|
7918
8052
|
var UnpublishDataAssemblyToolParams = BaseToolSchema.extend({
|
|
7919
|
-
dataAssemblyId:
|
|
7920
|
-
version:
|
|
8053
|
+
dataAssemblyId: z122.string().describe("The ID of the data assembly to unpublish"),
|
|
8054
|
+
version: z122.number().describe(
|
|
7921
8055
|
"REQUIRED. The data assembly's sys.version as returned by get_data_assembly. You must call get_data_assembly first to read the current state and version. The unpublish is rejected if this does not match the current version, which means the data assembly changed since you read it."
|
|
7922
8056
|
)
|
|
7923
8057
|
});
|
|
@@ -8106,16 +8240,16 @@ var ContentfulMcpTools = class {
|
|
|
8106
8240
|
return createContentTypeTools(this.config);
|
|
8107
8241
|
}
|
|
8108
8242
|
/**
|
|
8109
|
-
* Get ExO component
|
|
8243
|
+
* Get ExO component tools
|
|
8110
8244
|
*/
|
|
8111
|
-
|
|
8112
|
-
return
|
|
8245
|
+
getComponentTools() {
|
|
8246
|
+
return createComponentTools(this.config);
|
|
8113
8247
|
}
|
|
8114
8248
|
/**
|
|
8115
|
-
* Get ExO template tools
|
|
8249
|
+
* Get ExO experience template tools
|
|
8116
8250
|
*/
|
|
8117
|
-
|
|
8118
|
-
return
|
|
8251
|
+
getExperienceTemplateTools() {
|
|
8252
|
+
return createExperienceTemplateTools(this.config);
|
|
8119
8253
|
}
|
|
8120
8254
|
/**
|
|
8121
8255
|
* Get ExO experience tools
|
|
@@ -8178,10 +8312,16 @@ var ContentfulMcpTools = class {
|
|
|
8178
8312
|
return createTaxonomyTools(this.config);
|
|
8179
8313
|
}
|
|
8180
8314
|
/**
|
|
8181
|
-
* Get
|
|
8315
|
+
* Get usage tools
|
|
8316
|
+
*/
|
|
8317
|
+
getUsageTools() {
|
|
8318
|
+
return createUsageTools(this.config);
|
|
8319
|
+
}
|
|
8320
|
+
/**
|
|
8321
|
+
* Get ExO experience fragment tools
|
|
8182
8322
|
*/
|
|
8183
|
-
|
|
8184
|
-
return
|
|
8323
|
+
getExperienceFragmentTools() {
|
|
8324
|
+
return createExperienceFragmentTools(this.config);
|
|
8185
8325
|
}
|
|
8186
8326
|
/**
|
|
8187
8327
|
* Get ExO data assembly tools
|
|
@@ -8198,10 +8338,10 @@ var ContentfulMcpTools = class {
|
|
|
8198
8338
|
};
|
|
8199
8339
|
|
|
8200
8340
|
// src/utils/entitlements.ts
|
|
8201
|
-
import { createClient as
|
|
8341
|
+
import { createClient as createClient17 } from "contentful-management";
|
|
8202
8342
|
var EXO_M1_FEATURE = "exoM1";
|
|
8203
8343
|
function createPlainClient(config) {
|
|
8204
|
-
return
|
|
8344
|
+
return createClient17(createClientConfig(config), { type: "plain" });
|
|
8205
8345
|
}
|
|
8206
8346
|
async function orgHasExoM1(client, organizationId) {
|
|
8207
8347
|
try {
|