@kontent-ai/mcp-server 0.21.9 β 0.21.11
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 +30 -1
- package/build/bin.js +7 -0
- package/build/schemas/contentTypeSchemas.js +24 -61
- package/build/schemas/filterVariantSchemas.js +2 -0
- package/build/schemas/listSchemas.js +26 -0
- package/build/schemas/patchSchemas/contentTypePatchSchemas.js +12 -64
- package/build/schemas/referenceObjectSchema.js +3 -5
- package/build/schemas/taxonomySchemas.js +4 -9
- package/build/test/utils/responseHelper.spec.js +450 -0
- package/build/tools/add-content-item-mapi.js +6 -13
- package/build/tools/add-content-type-mapi.js +6 -11
- package/build/tools/add-content-type-snippet-mapi.js +5 -8
- package/build/tools/add-taxonomy-group-mapi.js +1 -1
- package/build/tools/change-variant-workflow-step-mapi.js +5 -14
- package/build/tools/context/initial-context.js +40 -1
- package/build/tools/context/patch-operations-guide.js +58 -0
- package/build/tools/create-variant-version-mapi.js +3 -6
- package/build/tools/delete-content-item-mapi.js +2 -2
- package/build/tools/delete-content-type-mapi.js +2 -2
- package/build/tools/delete-language-variant-mapi.js +3 -5
- package/build/tools/filter-variants-mapi.js +13 -20
- package/build/tools/get-asset-mapi.js +2 -2
- package/build/tools/get-initial-context.js +2 -1
- package/build/tools/get-item-mapi.js +2 -2
- package/build/tools/get-taxonomy-group-mapi.js +2 -2
- package/build/tools/get-type-mapi.js +2 -2
- package/build/tools/get-type-snippet-mapi.js +2 -2
- package/build/tools/get-variant-mapi.js +5 -7
- package/build/tools/list-assets-mapi.js +12 -4
- package/build/tools/list-content-type-snippets-mapi.js +12 -4
- package/build/tools/list-content-types-mapi.js +12 -4
- package/build/tools/list-languages-mapi.js +12 -4
- package/build/tools/list-taxonomy-groups-mapi.js +12 -4
- package/build/tools/list-workflows-mapi.js +1 -1
- package/build/tools/patch-content-type-mapi.js +3 -50
- package/build/tools/publish-variant-mapi.js +5 -8
- package/build/tools/search-variants-mapi.js +3 -29
- package/build/tools/unpublish-variant-mapi.js +5 -8
- package/build/tools/update-content-item-mapi.js +4 -4
- package/build/tools/upsert-language-variant-mapi.js +7 -10
- package/build/utils/responseHelper.js +90 -6
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ Kontent.ai MCP Server implements the Model Context Protocol to connect your Kont
|
|
|
23
23
|
- [π Quickstart](#-quickstart)
|
|
24
24
|
- [π οΈ Available Tools](#οΈ-available-tools)
|
|
25
25
|
- [βοΈ Configuration](#οΈ-configuration)
|
|
26
|
+
- [π§ Response Optimization](#-response-optimization)
|
|
26
27
|
- [π Transport Options](#-transport-options)
|
|
27
28
|
- [π» Development](#-development)
|
|
28
29
|
- [π Local Installation](#-local-installation)
|
|
@@ -95,7 +96,7 @@ npx @kontent-ai/mcp-server@latest shttp
|
|
|
95
96
|
* **upsert-language-variant-mapi** β Create or update Kontent.ai language variant of a content item via Management API. This adds actual content to the content item elements. When updating an existing variant, only the provided elements will be modified
|
|
96
97
|
* **create-variant-version-mapi** β Create new version of Kontent.ai language variant via Management API. This operation creates a new version of an existing language variant, useful for content versioning and creating new drafts from published content
|
|
97
98
|
* **delete-language-variant-mapi** β Delete Kontent.ai language variant from Management API
|
|
98
|
-
* **filter-variants-mapi** β Filter Kontent.ai language variants of content items using Management API. Use for exact keyword matching and finding specific terms in content. Supports full filtering capabilities (content types, workflow steps, taxonomies, etc.) and optionally includes full content of variants
|
|
99
|
+
* **filter-variants-mapi** β Filter Kontent.ai language variants of content items using Management API. Use for exact keyword matching and finding specific terms in content. Supports full filtering capabilities (content types, workflow steps, taxonomies, etc.) and optionally includes full content of variants. Returns paginated results with continuation token for fetching subsequent pages
|
|
99
100
|
* **search-variants-mapi** β AI-powered semantic search for finding content by meaning and concepts in a specific language variant. Use for: conceptual searches when you don't know exact keywords. Limited filtering options (variant ID only)
|
|
100
101
|
|
|
101
102
|
### Asset Management
|
|
@@ -139,6 +140,34 @@ For multi-tenant mode (Streamable HTTP only), the server accepts:
|
|
|
139
140
|
|
|
140
141
|
This mode allows a single server instance to handle requests for multiple Kontent.ai environments securely without requiring environment variables.
|
|
141
142
|
|
|
143
|
+
## π§ Response Optimization
|
|
144
|
+
|
|
145
|
+
The MCP server implements automatic token optimization to reduce AI model costs and improve performance:
|
|
146
|
+
|
|
147
|
+
### Token Reduction Strategy
|
|
148
|
+
|
|
149
|
+
The server automatically removes empty/default values from responses to reduce token usage. This includes:
|
|
150
|
+
|
|
151
|
+
- Null and undefined values
|
|
152
|
+
- Empty strings (`""`)
|
|
153
|
+
- Empty arrays (`[]`)
|
|
154
|
+
- Empty objects (`{}`)
|
|
155
|
+
- Rich text placeholders (`"<p><br/></p>"`)
|
|
156
|
+
- Elements with only an ID after empty value removal
|
|
157
|
+
|
|
158
|
+
### Impact on AI Agents
|
|
159
|
+
|
|
160
|
+
**Important for AI implementations**: When consuming responses from this MCP server:
|
|
161
|
+
|
|
162
|
+
1. **Missing properties indicate default values**, not missing data
|
|
163
|
+
2. Missing elements in variants have their type-specific defaults:
|
|
164
|
+
- Text elements: `""` (empty string)
|
|
165
|
+
- Rich text: `"<p><br/></p>"` (empty placeholder)
|
|
166
|
+
- Number/Date: `null`
|
|
167
|
+
- Custom elements: `null` (for value and searchable_value)
|
|
168
|
+
- Arrays (assets, taxonomy, etc.): `[]`
|
|
169
|
+
3. When creating/updating content, always send complete data
|
|
170
|
+
|
|
142
171
|
## π Transport Options
|
|
143
172
|
|
|
144
173
|
### π STDIO Transport
|
package/build/bin.js
CHANGED
|
@@ -130,6 +130,13 @@ async function startStreamableHTTP() {
|
|
|
130
130
|
id: null,
|
|
131
131
|
}));
|
|
132
132
|
});
|
|
133
|
+
app.get("/health", (_, res) => {
|
|
134
|
+
res.json({
|
|
135
|
+
status: "ok",
|
|
136
|
+
timestamp: new Date().toISOString(),
|
|
137
|
+
currentVersion: version,
|
|
138
|
+
});
|
|
139
|
+
});
|
|
133
140
|
app.use((err, _req, _res, next) => {
|
|
134
141
|
trackException(err, "Express Error Handler");
|
|
135
142
|
next(err);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//
|
|
3
|
-
export const referenceObjectSchema = z
|
|
4
|
-
.object({
|
|
2
|
+
// Reference by id or codename (id preferred)
|
|
3
|
+
export const referenceObjectSchema = z.object({
|
|
5
4
|
id: z.string().optional(),
|
|
6
5
|
codename: z.string().optional(),
|
|
7
|
-
})
|
|
8
|
-
.describe("An object with an id or codename property referencing another item. Using id is preferred for better performance.");
|
|
6
|
+
});
|
|
9
7
|
// Common property schemas
|
|
10
8
|
const baseElementSchema = {
|
|
11
9
|
codename: z.string().optional(),
|
|
@@ -13,9 +11,7 @@ const baseElementSchema = {
|
|
|
13
11
|
};
|
|
14
12
|
// Content group schema for content type elements only
|
|
15
13
|
const contentGroupElementSchema = {
|
|
16
|
-
content_group: referenceObjectSchema
|
|
17
|
-
.describe("An object with an id or codename property referencing a content group.")
|
|
18
|
-
.optional(),
|
|
14
|
+
content_group: referenceObjectSchema.optional(),
|
|
19
15
|
};
|
|
20
16
|
const namedElementSchema = {
|
|
21
17
|
...baseElementSchema,
|
|
@@ -92,17 +88,14 @@ const assetElementSchema = {
|
|
|
92
88
|
maximum_file_size: z.number().optional(),
|
|
93
89
|
allowed_file_types: z.enum(["adjustable", "any"]).optional(),
|
|
94
90
|
...imageLimitSchema,
|
|
95
|
-
default: arrayDefaultSchema
|
|
91
|
+
default: arrayDefaultSchema,
|
|
96
92
|
};
|
|
97
93
|
const customElementSchema = {
|
|
98
94
|
type: z.literal("custom"),
|
|
99
95
|
...namedElementSchema,
|
|
100
96
|
source_url: z.string(),
|
|
101
97
|
json_parameters: z.string().optional(),
|
|
102
|
-
allowed_elements: z
|
|
103
|
-
.array(referenceObjectSchema.describe("An object with an id or codename property referencing an element."))
|
|
104
|
-
.optional()
|
|
105
|
-
.describe("Specifies which elements from the content type can be used within this custom element."),
|
|
98
|
+
allowed_elements: z.array(referenceObjectSchema).optional(),
|
|
106
99
|
};
|
|
107
100
|
const dateTimeElementSchema = {
|
|
108
101
|
type: z.literal("date_time"),
|
|
@@ -112,18 +105,14 @@ const dateTimeElementSchema = {
|
|
|
112
105
|
const guidelinesElementSchema = {
|
|
113
106
|
type: z.literal("guidelines"),
|
|
114
107
|
...baseElementSchema,
|
|
115
|
-
guidelines: z
|
|
116
|
-
.string()
|
|
117
|
-
.describe("Value of the guidelines element. This is rich text and can include HTML formatting. Check the documentation here https://kontent.ai/learn/docs/apis/openapi/management-api-v2/#section/HTML5-elements-allowed-in-rich-text for the supported format, but keep in mind that content items and components are not supported in guidelines. Use empty `<p>` tag for empty guidelines."),
|
|
108
|
+
guidelines: z.string(),
|
|
118
109
|
};
|
|
119
110
|
const modularContentElementSchema = {
|
|
120
111
|
type: z.literal("modular_content"),
|
|
121
112
|
...namedElementSchema,
|
|
122
|
-
allowed_content_types: z
|
|
123
|
-
.array(referenceObjectSchema.describe("An object with an id or codename property referencing a content type. Use an empty array to allow all content types."))
|
|
124
|
-
.optional(),
|
|
113
|
+
allowed_content_types: z.array(referenceObjectSchema).optional(),
|
|
125
114
|
item_count_limit: countLimitSchema,
|
|
126
|
-
default: arrayDefaultSchema
|
|
115
|
+
default: arrayDefaultSchema,
|
|
127
116
|
};
|
|
128
117
|
const subpagesElementSchema = {
|
|
129
118
|
type: z.literal("subpages"),
|
|
@@ -143,7 +132,7 @@ const multipleChoiceElementSchema = {
|
|
|
143
132
|
...namedElementSchema,
|
|
144
133
|
mode: z.enum(["single", "multiple"]),
|
|
145
134
|
options: z.array(optionSchema),
|
|
146
|
-
default: arrayDefaultSchema
|
|
135
|
+
default: arrayDefaultSchema,
|
|
147
136
|
};
|
|
148
137
|
const numberElementSchema = {
|
|
149
138
|
type: z.literal("number"),
|
|
@@ -200,38 +189,14 @@ export const allowedTableTextBlockSchema = z.enum([
|
|
|
200
189
|
const richTextElementSchema = {
|
|
201
190
|
type: z.literal("rich_text"),
|
|
202
191
|
...namedElementSchema,
|
|
203
|
-
allowed_blocks: z
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
allowed_text_blocks: z
|
|
212
|
-
.array(allowedTextBlockSchema)
|
|
213
|
-
.optional()
|
|
214
|
-
.describe("Specifies allowed text blocks. Use an empty array to allow all options."),
|
|
215
|
-
allowed_table_blocks: z
|
|
216
|
-
.array(allowedTableBlockSchema)
|
|
217
|
-
.optional()
|
|
218
|
-
.describe("Specifies allowed table blocks. Use an empty array to allow all options."),
|
|
219
|
-
allowed_table_formatting: z
|
|
220
|
-
.array(allowedTableFormattingSchema)
|
|
221
|
-
.optional()
|
|
222
|
-
.describe("Specifies allowed table formatting options. Use an empty array to allow all options."),
|
|
223
|
-
allowed_table_text_blocks: z
|
|
224
|
-
.array(allowedTableTextBlockSchema)
|
|
225
|
-
.optional()
|
|
226
|
-
.describe("Specifies allowed table text blocks. Use an empty array to allow all options."),
|
|
227
|
-
allowed_content_types: z
|
|
228
|
-
.array(referenceObjectSchema.describe("An object with an id or codename property referencing a content type."))
|
|
229
|
-
.optional()
|
|
230
|
-
.describe("Specifies allowed content types. Use an empty array to allow all content types."),
|
|
231
|
-
allowed_item_link_types: z
|
|
232
|
-
.array(referenceObjectSchema.describe("An object with an id or codename property referencing a content type."))
|
|
233
|
-
.optional()
|
|
234
|
-
.describe("Specifies allowed item link types. Use an empty array to allow all link types."),
|
|
192
|
+
allowed_blocks: z.array(allowedBlockSchema).optional(),
|
|
193
|
+
allowed_formatting: z.array(allowedFormattingSchema).optional(),
|
|
194
|
+
allowed_text_blocks: z.array(allowedTextBlockSchema).optional(),
|
|
195
|
+
allowed_table_blocks: z.array(allowedTableBlockSchema).optional(),
|
|
196
|
+
allowed_table_formatting: z.array(allowedTableFormattingSchema).optional(),
|
|
197
|
+
allowed_table_text_blocks: z.array(allowedTableTextBlockSchema).optional(),
|
|
198
|
+
allowed_content_types: z.array(referenceObjectSchema).optional(),
|
|
199
|
+
allowed_item_link_types: z.array(referenceObjectSchema).optional(),
|
|
235
200
|
...imageLimitSchema,
|
|
236
201
|
allowed_image_types: z.enum(["adjustable", "any"]).optional(),
|
|
237
202
|
maximum_image_size: z.number().optional(),
|
|
@@ -239,15 +204,15 @@ const richTextElementSchema = {
|
|
|
239
204
|
};
|
|
240
205
|
const snippetElement = {
|
|
241
206
|
type: z.literal("snippet"),
|
|
242
|
-
snippet: referenceObjectSchema
|
|
207
|
+
snippet: referenceObjectSchema,
|
|
243
208
|
...baseElementSchema,
|
|
244
209
|
};
|
|
245
210
|
const taxonomyElementSchema = {
|
|
246
211
|
type: z.literal("taxonomy"),
|
|
247
|
-
taxonomy_group: referenceObjectSchema
|
|
212
|
+
taxonomy_group: referenceObjectSchema,
|
|
248
213
|
...namedElementSchema,
|
|
249
214
|
term_count_limit: countLimitSchema,
|
|
250
|
-
default: arrayDefaultSchema
|
|
215
|
+
default: arrayDefaultSchema,
|
|
251
216
|
};
|
|
252
217
|
const textElementSchema = {
|
|
253
218
|
type: z.literal("text"),
|
|
@@ -257,15 +222,13 @@ const textElementSchema = {
|
|
|
257
222
|
default: stringDefaultSchema,
|
|
258
223
|
};
|
|
259
224
|
export const dependsOnSchema = z.object({
|
|
260
|
-
element: referenceObjectSchema
|
|
261
|
-
snippet: referenceObjectSchema
|
|
262
|
-
.describe("An object with an id or codename property referencing a content type snippet.")
|
|
263
|
-
.optional(),
|
|
225
|
+
element: referenceObjectSchema,
|
|
226
|
+
snippet: referenceObjectSchema.optional(),
|
|
264
227
|
});
|
|
265
228
|
const urlSlugElementSchema = {
|
|
266
229
|
type: z.literal("url_slug"),
|
|
267
230
|
...namedElementSchema,
|
|
268
|
-
depends_on: dependsOnSchema
|
|
231
|
+
depends_on: dependsOnSchema,
|
|
269
232
|
validation_regex: regexValidationSchema,
|
|
270
233
|
};
|
|
271
234
|
// Define a union type of all possible element types for content types
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { continuationTokenField } from "./listSchemas.js";
|
|
2
3
|
import { referenceObjectSchema } from "./referenceObjectSchema.js";
|
|
3
4
|
// UserReferenceDataContract is a union type - either id or email, but not both
|
|
4
5
|
const userReferenceSchema = z
|
|
@@ -79,4 +80,5 @@ export const filterVariantsSchema = z.object({
|
|
|
79
80
|
.boolean()
|
|
80
81
|
.optional()
|
|
81
82
|
.describe("Whether to include the full content of language variants in the response"),
|
|
83
|
+
continuation_token: continuationTokenField,
|
|
82
84
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Reusable continuation token schema for paginated list operations
|
|
3
|
+
export const continuationTokenField = z
|
|
4
|
+
.string()
|
|
5
|
+
.optional()
|
|
6
|
+
.describe("Continuation token from a previous response to fetch the next page of results. Omit this parameter (or set to null) to fetch the first page. The response will include a continuation_token field - use this value in the next request to fetch the next page. When continuation_token in the response is null, there are no more pages available.");
|
|
7
|
+
// Schema for listing taxonomy groups
|
|
8
|
+
export const listTaxonomyGroupsSchema = z.object({
|
|
9
|
+
continuation_token: continuationTokenField,
|
|
10
|
+
});
|
|
11
|
+
// Schema for listing languages
|
|
12
|
+
export const listLanguagesSchema = z.object({
|
|
13
|
+
continuation_token: continuationTokenField,
|
|
14
|
+
});
|
|
15
|
+
// Schema for listing content types
|
|
16
|
+
export const listContentTypesSchema = z.object({
|
|
17
|
+
continuation_token: continuationTokenField,
|
|
18
|
+
});
|
|
19
|
+
// Schema for listing content type snippets
|
|
20
|
+
export const listContentTypeSnippetsSchema = z.object({
|
|
21
|
+
continuation_token: continuationTokenField,
|
|
22
|
+
});
|
|
23
|
+
// Schema for listing assets
|
|
24
|
+
export const listAssetsSchema = z.object({
|
|
25
|
+
continuation_token: continuationTokenField,
|
|
26
|
+
});
|
|
@@ -5,37 +5,15 @@ import { allowedBlockSchema, allowedFormattingSchema, allowedTableBlockSchema, a
|
|
|
5
5
|
// Move operation - Move elements within content type
|
|
6
6
|
const moveOperationSchema = z.object({
|
|
7
7
|
op: z.literal("move"),
|
|
8
|
-
path: z
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000' - Move an element
|
|
12
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/options/id:987fcdeb-51a2-43d1-9f4e-123456789abc' - Move a multiple choice option (first reference is element, second is option)
|
|
13
|
-
β’ '/content_groups/id:456e7890-a12b-34c5-d678-901234567def' - Move a content group`),
|
|
14
|
-
before: referenceObjectSchema
|
|
15
|
-
.describe("A reference to the object before which you want to move the object. For example, to move an element before an existing element with id:uuid 'text', set before to {codename: 'text'}. The before and after properties are mutually exclusive.")
|
|
16
|
-
.optional(),
|
|
17
|
-
after: referenceObjectSchema
|
|
18
|
-
.describe("A reference to the object after which you want to move the object. For example, to move an element after an existing element with id:uuid 'Text', set after to {codename: 'text'}. The before and after properties are mutually exclusive.")
|
|
19
|
-
.optional(),
|
|
8
|
+
path: z.string().describe("Path to object (format: id:{uuid})"),
|
|
9
|
+
before: referenceObjectSchema.optional(),
|
|
10
|
+
after: referenceObjectSchema.optional(),
|
|
20
11
|
});
|
|
21
12
|
// AddInto operation - Add new elements to content type
|
|
22
13
|
const addIntoOperationSchema = z.object({
|
|
23
14
|
op: z.literal("addInto"),
|
|
24
|
-
path: z
|
|
25
|
-
|
|
26
|
-
.describe(`JSON Pointer path where to add the item. The path reference should be in format 'id:{uuid}'. Examples:
|
|
27
|
-
β’ '/elements' - Add a new element to the content type
|
|
28
|
-
β’ '/content_groups' - Add a new content group
|
|
29
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/allowed_content_types' - Add allowed content type to rich text or linked items element
|
|
30
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/allowed_elements' - Add allowed element to custom element
|
|
31
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/options' - Add multiple choice option
|
|
32
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/allowed_blocks' - Add block for rich text element
|
|
33
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/allowed_formatting' - Add formatting option for rich text element
|
|
34
|
-
(Replace with actual element UUID)
|
|
35
|
-
|
|
36
|
-
- CRITICAL: When adding a url slug that references a snippet element, first add the snippet element to the content type if itβs not already included.`),
|
|
37
|
-
value: z
|
|
38
|
-
.union([
|
|
15
|
+
path: z.string().describe("Path where to add item (format: id:{uuid})"),
|
|
16
|
+
value: z.union([
|
|
39
17
|
elementSchema,
|
|
40
18
|
optionSchema,
|
|
41
19
|
contentGroupSchema,
|
|
@@ -51,44 +29,18 @@ const addIntoOperationSchema = z.object({
|
|
|
51
29
|
z.boolean(),
|
|
52
30
|
z.null(),
|
|
53
31
|
z.any(),
|
|
54
|
-
])
|
|
55
|
-
.describe("The item to add (element, content group, option, etc.)"),
|
|
32
|
+
]),
|
|
56
33
|
});
|
|
57
34
|
// Remove operation - Remove elements from content type
|
|
58
35
|
const removeOperationSchema = z.object({
|
|
59
36
|
op: z.literal("remove"),
|
|
60
|
-
path: z
|
|
61
|
-
.string()
|
|
62
|
-
.describe(`JSON Pointer path to the item being removed. The path reference should be in format 'id:{uuid}'. Examples:
|
|
63
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000' - Remove an element
|
|
64
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/allowed_content_types/id:987fcdeb-51a2-43d1-9f4e-123456789abc' - Remove allowed content type from rich text/linked items element
|
|
65
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/allowed_element/id:456e7890-a12b-34c5-d678-901234567def' - Remove allowed element from custom element
|
|
66
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/options/id:321dcba9-87f6-54e3-21b0-fedcba987654' - Remove multiple choice option
|
|
67
|
-
β’ '/content_groups/id:456e7890-a12b-34c5-d678-901234567def' - Remove content group (removes all elements within the group)
|
|
68
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/allowed_blocks/images' - Remove rich-text element limitation (where {block} is the limitation type)
|
|
69
|
-
(Replace with actual UUIDs)`),
|
|
37
|
+
path: z.string().describe("Path to item to remove (format: id:{uuid})"),
|
|
70
38
|
});
|
|
71
39
|
// Replace operation - Replace/update existing elements in content type
|
|
72
40
|
const replaceOperationSchema = z.object({
|
|
73
41
|
op: z.literal("replace"),
|
|
74
|
-
path: z
|
|
75
|
-
|
|
76
|
-
.describe(`JSON Pointer path to the item or property being replaced. The path reference should be in format 'id:{uuid}' Examples:
|
|
77
|
-
β’ '/name' - Change the content type's name
|
|
78
|
-
β’ '/codename' - Change the content type's codename
|
|
79
|
-
β’ '/content_groups/id:456e7890-a12b-34c5-d678-901234567def/name' - Change the name of a content group
|
|
80
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/name' - Change an element property (property depends on element type)
|
|
81
|
-
β’ '/elements/id:123e4567-e89b-12d3-a456-426614174000/options/id:321dcba9-87f6-54e3-21b0-fedcba987654/name' - Change multiple choice option property (name or codename)
|
|
82
|
-
(Replace with actual element/group UUIDs)
|
|
83
|
-
|
|
84
|
-
REPLACE OPERATION RULES:
|
|
85
|
-
β’ CAN modify: Most element properties based on element type (name, guidelines, validation, etc.)
|
|
86
|
-
β’ CANNOT modify: external_id, id, or type of elements
|
|
87
|
-
β’ CANNOT replace individual object values - must replace the entire object at once
|
|
88
|
-
β’ FOR rich text elements: CANNOT replace individual items in allowed_blocks, allowed_formatting, allowed_text_blocks, allowed_table_blocks, allowed_table_formatting, allowed_table_text_blocks, allowed_content_types, allowed_item_link_types arrays - use addInto/remove operations instead for individual items
|
|
89
|
-
β’ FOR multiple choice options: Can modify name and codename properties`),
|
|
90
|
-
value: z
|
|
91
|
-
.union([
|
|
42
|
+
path: z.string().describe("Path to property to replace (format: id:{uuid})"),
|
|
43
|
+
value: z.union([
|
|
92
44
|
dependsOnSchema,
|
|
93
45
|
regexValidationSchema,
|
|
94
46
|
textLengthLimitSchema,
|
|
@@ -100,9 +52,8 @@ const replaceOperationSchema = z.object({
|
|
|
100
52
|
z.number(),
|
|
101
53
|
z.boolean(),
|
|
102
54
|
z.null(),
|
|
103
|
-
z.any(),
|
|
104
|
-
])
|
|
105
|
-
.describe("The new value to replace the existing one"),
|
|
55
|
+
z.any(),
|
|
56
|
+
]),
|
|
106
57
|
});
|
|
107
58
|
// Union type for all patch operations
|
|
108
59
|
export const patchOperationSchema = z.discriminatedUnion("op", [
|
|
@@ -112,7 +63,4 @@ export const patchOperationSchema = z.discriminatedUnion("op", [
|
|
|
112
63
|
replaceOperationSchema,
|
|
113
64
|
]);
|
|
114
65
|
// Schema for array of patch operations
|
|
115
|
-
export const patchOperationsSchema = z
|
|
116
|
-
.array(patchOperationSchema)
|
|
117
|
-
.min(1)
|
|
118
|
-
.describe("Array of patch operations to apply to the content type. Must contain at least one operation.");
|
|
66
|
+
export const patchOperationsSchema = z.array(patchOperationSchema).min(1);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
-
//
|
|
3
|
-
export const referenceObjectSchema = z
|
|
4
|
-
.object({
|
|
2
|
+
// Reference by id, codename, or external_id (id preferred)
|
|
3
|
+
export const referenceObjectSchema = z.object({
|
|
5
4
|
id: z.string().optional(),
|
|
6
5
|
codename: z.string().optional(),
|
|
7
6
|
external_id: z.string().optional(),
|
|
8
|
-
})
|
|
9
|
-
.describe("An object with an id, codename, or external_id property referencing another item. Using id is preferred for better performance.");
|
|
7
|
+
});
|
|
@@ -8,16 +8,11 @@ const taxonomyTermSchema = z.object({
|
|
|
8
8
|
});
|
|
9
9
|
// Schema for a taxonomy group
|
|
10
10
|
export const taxonomyGroupSchemas = {
|
|
11
|
-
name: z.string().describe("
|
|
11
|
+
name: z.string().describe("Taxonomy group name"),
|
|
12
12
|
codename: z
|
|
13
13
|
.string()
|
|
14
14
|
.optional()
|
|
15
|
-
.describe("Codename
|
|
16
|
-
external_id: z
|
|
17
|
-
|
|
18
|
-
.optional()
|
|
19
|
-
.describe("External ID of the taxonomy group (optional)"),
|
|
20
|
-
terms: z
|
|
21
|
-
.array(taxonomyTermSchema)
|
|
22
|
-
.describe("Hierarchical structure of taxonomy terms"),
|
|
15
|
+
.describe("Codename (auto-generated if omitted)"),
|
|
16
|
+
external_id: z.string().optional().describe("External ID"),
|
|
17
|
+
terms: z.array(taxonomyTermSchema).describe("Taxonomy terms hierarchy"),
|
|
23
18
|
};
|