@kontent-ai/mcp-server 0.31.0 → 0.33.0

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.
Files changed (119) hide show
  1. package/README.md +57 -61
  2. package/build/schemas/bulkGetItemsWithVariantsSchemas.js +1 -1
  3. package/build/schemas/contentItemSchemas.js +1 -1
  4. package/build/schemas/filterVariantSchemas.js +8 -3
  5. package/build/schemas/searchOperationSchemas.js +2 -1
  6. package/build/server.js +4 -112
  7. package/build/test/bm25/bm25.js +47 -0
  8. package/build/test/bm25/toolSearchBm25.spec.js +874 -0
  9. package/build/tools/bulk-get-content-item-variants.js +31 -0
  10. package/build/tools/change-content-item-variant-workflow-step.js +35 -0
  11. package/build/tools/create-content-item-variant.js +44 -0
  12. package/build/tools/create-content-item.js +47 -0
  13. package/build/tools/create-content-type-snippet.js +34 -0
  14. package/build/tools/create-content-type.js +37 -0
  15. package/build/tools/create-language.js +24 -0
  16. package/build/tools/create-new-content-item-variant-version.js +27 -0
  17. package/build/tools/create-space.js +22 -0
  18. package/build/tools/create-taxonomy-group.js +18 -0
  19. package/build/tools/create-workflow.js +23 -0
  20. package/build/tools/delete-content-item-variant.js +25 -0
  21. package/build/tools/delete-content-item.js +23 -0
  22. package/build/tools/delete-content-type-snippet.js +19 -0
  23. package/build/tools/delete-content-type.js +23 -0
  24. package/build/tools/delete-space.js +19 -0
  25. package/build/tools/delete-taxonomy-group.js +19 -0
  26. package/build/tools/delete-workflow.js +19 -0
  27. package/build/tools/get-asset.js +17 -0
  28. package/build/tools/get-content-item-translations.js +20 -0
  29. package/build/tools/get-content-item-variant.js +22 -0
  30. package/build/tools/get-content-item.js +17 -0
  31. package/build/tools/get-content-type-snippet.js +20 -0
  32. package/build/tools/get-content-type.js +17 -0
  33. package/build/tools/get-patch-guide.js +12 -12
  34. package/build/tools/get-published-content-item-variant-version.js +23 -0
  35. package/build/tools/get-taxonomy-group.js +17 -0
  36. package/build/tools/index.js +106 -0
  37. package/build/tools/list-asset-folders.js +14 -0
  38. package/build/tools/list-assets.js +23 -0
  39. package/build/tools/list-collections.js +14 -0
  40. package/build/tools/list-content-item-variants.js +50 -0
  41. package/build/tools/list-content-type-snippets.js +23 -0
  42. package/build/tools/list-content-types.js +23 -0
  43. package/build/tools/list-languages.js +24 -0
  44. package/build/tools/list-roles.js +14 -0
  45. package/build/tools/list-spaces.js +14 -0
  46. package/build/tools/list-taxonomy-groups.js +23 -0
  47. package/build/tools/list-workflows.js +14 -0
  48. package/build/tools/patch-asset-folders.js +25 -0
  49. package/build/tools/patch-collections.js +25 -0
  50. package/build/tools/patch-content-type-snippet.js +30 -0
  51. package/build/tools/patch-content-type.js +33 -0
  52. package/build/tools/patch-language.js +24 -0
  53. package/build/tools/patch-space.js +28 -0
  54. package/build/tools/patch-taxonomy-group.js +28 -0
  55. package/build/tools/publish-content-item-variant.js +72 -0
  56. package/build/tools/referencedToolNames.js +10 -0
  57. package/build/tools/search-content-item-variants.js +108 -0
  58. package/build/tools/toolDefinition.js +1 -0
  59. package/build/tools/unpublish-content-item-variant.js +72 -0
  60. package/build/tools/update-asset.js +23 -0
  61. package/build/tools/update-content-item-variant.js +36 -0
  62. package/build/tools/update-content-item.js +74 -0
  63. package/build/tools/update-workflow.js +31 -0
  64. package/package.json +18 -17
  65. package/build/tools/add-content-item-mapi.js +0 -47
  66. package/build/tools/add-content-type-mapi.js +0 -38
  67. package/build/tools/add-content-type-snippet-mapi.js +0 -35
  68. package/build/tools/add-language-mapi.js +0 -25
  69. package/build/tools/add-space-mapi.js +0 -23
  70. package/build/tools/add-taxonomy-group-mapi.js +0 -19
  71. package/build/tools/add-workflow-mapi.js +0 -24
  72. package/build/tools/bulk-get-items-variants-mapi.js +0 -31
  73. package/build/tools/change-variant-workflow-step-mapi.js +0 -36
  74. package/build/tools/create-language-variant-mapi.js +0 -44
  75. package/build/tools/create-variant-version-mapi.js +0 -28
  76. package/build/tools/delete-content-item-mapi.js +0 -24
  77. package/build/tools/delete-content-type-mapi.js +0 -24
  78. package/build/tools/delete-language-variant-mapi.js +0 -26
  79. package/build/tools/delete-space-mapi.js +0 -20
  80. package/build/tools/delete-taxonomy-group-mapi.js +0 -20
  81. package/build/tools/delete-type-snippet-mapi.js +0 -23
  82. package/build/tools/delete-workflow-mapi.js +0 -20
  83. package/build/tools/filter-variants-mapi.js +0 -49
  84. package/build/tools/get-asset-mapi.js +0 -21
  85. package/build/tools/get-item-mapi.js +0 -21
  86. package/build/tools/get-latest-variant-mapi.js +0 -23
  87. package/build/tools/get-published-variant-mapi.js +0 -24
  88. package/build/tools/get-taxonomy-group-mapi.js +0 -21
  89. package/build/tools/get-type-mapi.js +0 -21
  90. package/build/tools/get-type-snippet-mapi.js +0 -21
  91. package/build/tools/list-asset-folders-mapi.js +0 -15
  92. package/build/tools/list-assets-mapi.js +0 -24
  93. package/build/tools/list-collections-mapi.js +0 -15
  94. package/build/tools/list-content-type-snippets-mapi.js +0 -24
  95. package/build/tools/list-content-types-mapi.js +0 -24
  96. package/build/tools/list-languages-mapi.js +0 -24
  97. package/build/tools/list-roles-mapi.js +0 -15
  98. package/build/tools/list-spaces-mapi.js +0 -15
  99. package/build/tools/list-taxonomy-groups-mapi.js +0 -24
  100. package/build/tools/list-variants-collection-mapi.js +0 -26
  101. package/build/tools/list-variants-components-type-mapi.js +0 -26
  102. package/build/tools/list-variants-item-mapi.js +0 -21
  103. package/build/tools/list-variants-space-mapi.js +0 -24
  104. package/build/tools/list-variants-type-mapi.js +0 -26
  105. package/build/tools/list-workflows-mapi.js +0 -15
  106. package/build/tools/patch-asset-folders-mapi.js +0 -25
  107. package/build/tools/patch-collections-mapi.js +0 -25
  108. package/build/tools/patch-content-type-mapi.js +0 -33
  109. package/build/tools/patch-language-mapi.js +0 -24
  110. package/build/tools/patch-space-mapi.js +0 -28
  111. package/build/tools/patch-taxonomy-group-mapi.js +0 -28
  112. package/build/tools/patch-type-snippet-mapi.js +0 -30
  113. package/build/tools/publish-variant-mapi.js +0 -73
  114. package/build/tools/search-variants-mapi.js +0 -108
  115. package/build/tools/unpublish-variant-mapi.js +0 -73
  116. package/build/tools/update-asset-mapi.js +0 -24
  117. package/build/tools/update-content-item-mapi.js +0 -74
  118. package/build/tools/update-language-variant-mapi.js +0 -37
  119. package/build/tools/update-workflow-mapi.js +0 -32
@@ -1,24 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { listContentTypeSnippetsSchema } from "../schemas/listSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("list-content-type-snippets-mapi", "Get all Kontent.ai content type snippets (paginated). Snippets are reusable element sets included in content types via snippet element.", listContentTypeSnippetsSchema.shape, async ({ continuation_token }, { authInfo: { token, clientId } = {} }) => {
7
- const client = createMapiClient(clientId, token);
8
- try {
9
- const query = client.listContentTypeSnippets();
10
- const response = await (continuation_token
11
- ? query.xContinuationToken(continuation_token)
12
- : query).toPromise();
13
- return createMcpToolSuccessResponse({
14
- data: response.rawData.snippets,
15
- pagination: {
16
- continuation_token: response.data.pagination.continuationToken,
17
- },
18
- });
19
- }
20
- catch (error) {
21
- return handleMcpToolError(error, "Content Type Snippets Listing");
22
- }
23
- });
24
- };
@@ -1,24 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { listContentTypesSchema } from "../schemas/listSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("list-content-types-mapi", "Get all Kontent.ai content types (paginated). Types define variant structure: field definitions, validation rules, and element types.", listContentTypesSchema.shape, async ({ continuation_token }, { authInfo: { token, clientId } = {} }) => {
7
- const client = createMapiClient(clientId, token);
8
- try {
9
- const query = client.listContentTypes();
10
- const response = await (continuation_token
11
- ? query.xContinuationToken(continuation_token)
12
- : query).toPromise();
13
- return createMcpToolSuccessResponse({
14
- data: response.rawData.types,
15
- pagination: {
16
- continuation_token: response.data.pagination.continuationToken,
17
- },
18
- });
19
- }
20
- catch (error) {
21
- return handleMcpToolError(error, "Content Types Listing");
22
- }
23
- });
24
- };
@@ -1,24 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { listLanguagesSchema } from "../schemas/listSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("list-languages-mapi", "Get all Kontent.ai languages (paginated), including inactive ones - check is_active property. Languages define available locales; each can have fallback language for content inheritance.", listLanguagesSchema.shape, async ({ continuation_token }, { authInfo: { token, clientId } = {} }) => {
7
- const client = createMapiClient(clientId, token);
8
- try {
9
- const query = client.listLanguages();
10
- const response = await (continuation_token
11
- ? query.xContinuationToken(continuation_token)
12
- : query).toPromise();
13
- return createMcpToolSuccessResponse({
14
- data: response.rawData.languages,
15
- pagination: {
16
- continuation_token: response.data.pagination.continuationToken,
17
- },
18
- });
19
- }
20
- catch (error) {
21
- return handleMcpToolError(error, "Languages Listing");
22
- }
23
- });
24
- };
@@ -1,15 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { handleMcpToolError } from "../utils/errorHandler.js";
3
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
4
- export const registerTool = (server) => {
5
- server.tool("list-roles-mapi", "Get all Kontent.ai roles", {}, async (_, { authInfo: { token, clientId } = {} }) => {
6
- const client = createMapiClient(clientId, token);
7
- try {
8
- const response = await client.listRoles().toPromise();
9
- return createMcpToolSuccessResponse(response.rawData.roles);
10
- }
11
- catch (error) {
12
- return handleMcpToolError(error, "Roles Listing");
13
- }
14
- });
15
- };
@@ -1,15 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { handleMcpToolError } from "../utils/errorHandler.js";
3
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
4
- export const registerTool = (server) => {
5
- server.tool("list-spaces-mapi", "List all Kontent.ai spaces. Spaces provide channel-specific context for managing multiple websites/channels. Each space has its own domain and preview URLs; collections connect to spaces to organize content per channel.", {}, async (_, { authInfo: { token, clientId } = {} }) => {
6
- const client = createMapiClient(clientId, token);
7
- try {
8
- const response = await client.listSpaces().toPromise();
9
- return createMcpToolSuccessResponse(response.rawData);
10
- }
11
- catch (error) {
12
- return handleMcpToolError(error, "Spaces Listing");
13
- }
14
- });
15
- };
@@ -1,24 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { listTaxonomyGroupsSchema } from "../schemas/listSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("list-taxonomy-groups-mapi", "List all Kontent.ai taxonomy groups (paginated). Taxonomy groups are hierarchical with tree-structured terms that can be nested to any depth for flexible content categorization.", listTaxonomyGroupsSchema.shape, async ({ continuation_token }, { authInfo: { token, clientId } = {} }) => {
7
- const client = createMapiClient(clientId, token);
8
- try {
9
- const query = client.listTaxonomies();
10
- const response = await (continuation_token
11
- ? query.xContinuationToken(continuation_token)
12
- : query).toPromise();
13
- return createMcpToolSuccessResponse({
14
- data: response.rawData.taxonomies,
15
- pagination: {
16
- continuation_token: response.data.pagination.continuationToken,
17
- },
18
- });
19
- }
20
- catch (error) {
21
- return handleMcpToolError(error, "Taxonomy Groups Listing");
22
- }
23
- });
24
- };
@@ -1,26 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { listVariantsCollectionSchema } from "../schemas/listSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("list-variants-collection-mapi", "List Kontent.ai language variants by collection from Management API (paginated)", listVariantsCollectionSchema.describe("Use list-collections-mapi to get collection ID if not provided").shape, async ({ collectionId, continuation_token }, { authInfo: { token, clientId } = {} }) => {
7
- const client = createMapiClient(clientId, token);
8
- try {
9
- const query = client
10
- .listLanguageVariantsByCollection()
11
- .byCollectionId(collectionId);
12
- const response = await (continuation_token
13
- ? query.xContinuationToken(continuation_token)
14
- : query).toPromise();
15
- return createMcpToolSuccessResponse({
16
- variants: response.rawData.variants,
17
- pagination: {
18
- continuation_token: response.data.pagination.continuationToken,
19
- },
20
- });
21
- }
22
- catch (error) {
23
- return handleMcpToolError(error, "Collection Variants Listing");
24
- }
25
- });
26
- };
@@ -1,26 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { listVariantsComponentsTypeSchema } from "../schemas/listSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("list-variants-components-type-mapi", "List Kontent.ai language variants containing components of a specific content type from Management API (paginated)", listVariantsComponentsTypeSchema.shape, async ({ contentTypeId, continuation_token }, { authInfo: { token, clientId } = {} }) => {
7
- const client = createMapiClient(clientId, token);
8
- try {
9
- const query = client
10
- .listLanguageVariantsOfContentTypeWithComponents()
11
- .byTypeId(contentTypeId);
12
- const response = await (continuation_token
13
- ? query.xContinuationToken(continuation_token)
14
- : query).toPromise();
15
- return createMcpToolSuccessResponse({
16
- variants: response.rawData.variants,
17
- pagination: {
18
- continuation_token: response.data.pagination.continuationToken,
19
- },
20
- });
21
- }
22
- catch (error) {
23
- return handleMcpToolError(error, "Content Type Variants With Components Listing");
24
- }
25
- });
26
- };
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- import { createMapiClient } from "../clients/kontentClients.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("list-variants-item-mapi", "List all Kontent.ai language variants of a content item from Management API", {
7
- itemId: z.string().describe("Content item ID"),
8
- }, async ({ itemId }, { authInfo: { token, clientId } = {} }) => {
9
- const client = createMapiClient(clientId, token);
10
- try {
11
- const response = await client
12
- .listLanguageVariantsOfItem()
13
- .byItemId(itemId)
14
- .toPromise();
15
- return createMcpToolSuccessResponse(response.rawData);
16
- }
17
- catch (error) {
18
- return handleMcpToolError(error, "Item Variants Listing");
19
- }
20
- });
21
- };
@@ -1,24 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { listVariantsSpaceSchema } from "../schemas/listSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("list-variants-space-mapi", "List Kontent.ai language variants by space from Management API (paginated)", listVariantsSpaceSchema.shape, async ({ spaceId, continuation_token }, { authInfo: { token, clientId } = {} }) => {
7
- const client = createMapiClient(clientId, token);
8
- try {
9
- const query = client.listLanguageVariantsBySpace().bySpaceId(spaceId);
10
- const response = await (continuation_token
11
- ? query.xContinuationToken(continuation_token)
12
- : query).toPromise();
13
- return createMcpToolSuccessResponse({
14
- variants: response.rawData.variants,
15
- pagination: {
16
- continuation_token: response.data.pagination.continuationToken,
17
- },
18
- });
19
- }
20
- catch (error) {
21
- return handleMcpToolError(error, "Space Variants Listing");
22
- }
23
- });
24
- };
@@ -1,26 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { listVariantsTypeSchema } from "../schemas/listSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("list-variants-type-mapi", "List Kontent.ai language variants by content type from Management API (paginated)", listVariantsTypeSchema.shape, async ({ contentTypeId, continuation_token }, { authInfo: { token, clientId } = {} }) => {
7
- const client = createMapiClient(clientId, token);
8
- try {
9
- const query = client
10
- .listLanguageVariantsOfContentType()
11
- .byTypeId(contentTypeId);
12
- const response = await (continuation_token
13
- ? query.xContinuationToken(continuation_token)
14
- : query).toPromise();
15
- return createMcpToolSuccessResponse({
16
- variants: response.rawData.variants,
17
- pagination: {
18
- continuation_token: response.data.pagination.continuationToken,
19
- },
20
- });
21
- }
22
- catch (error) {
23
- return handleMcpToolError(error, "Content Type Variants Listing");
24
- }
25
- });
26
- };
@@ -1,15 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { handleMcpToolError } from "../utils/errorHandler.js";
3
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
4
- export const registerTool = (server) => {
5
- server.tool("list-workflows-mapi", "Get all Kontent.ai workflows. Workflow states manage content lifecycle: drafting, review, published, archived.", {}, async (_, { authInfo: { token, clientId } = {} }) => {
6
- const client = createMapiClient(clientId, token);
7
- try {
8
- const response = await client.listWorkflows().toPromise();
9
- return createMcpToolSuccessResponse(response.rawData);
10
- }
11
- catch (error) {
12
- return handleMcpToolError(error, "Workflows Listing");
13
- }
14
- });
15
- };
@@ -1,25 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { assetFolderPatchOperationsSchema } from "../schemas/assetFolderSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("patch-asset-folders-mapi", "Modify Kontent.ai asset folders using patch operations (addInto, rename, remove). Call get-patch-guide first for operations reference.", {
7
- operations: assetFolderPatchOperationsSchema,
8
- }, async ({ operations }, { authInfo: { token, clientId } = {} }) => {
9
- const client = createMapiClient(clientId, token);
10
- try {
11
- const response = await client
12
- .modifyAssetFolders()
13
- .withData(operations)
14
- .toPromise();
15
- return createMcpToolSuccessResponse({
16
- message: `Asset folders modified with ${operations.length} operation(s)`,
17
- folders: response.rawData,
18
- appliedOperations: operations,
19
- });
20
- }
21
- catch (error) {
22
- return handleMcpToolError(error, "Asset Folders Modification");
23
- }
24
- });
25
- };
@@ -1,25 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { collectionPatchOperationsSchema } from "../schemas/collectionSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("patch-collections-mapi", "Update Kontent.ai collections using patch operations. Call get-patch-guide first for operations reference.", {
7
- operations: collectionPatchOperationsSchema.describe("Patch operations array. Call list-collections-mapi first. Use addInto to add new collections, move to reorder, remove to delete empty collections, replace to rename."),
8
- }, async ({ operations }, { authInfo: { token, clientId } = {} }) => {
9
- const client = createMapiClient(clientId, token);
10
- try {
11
- const response = await client
12
- .setCollections()
13
- .withData(operations)
14
- .toPromise();
15
- return createMcpToolSuccessResponse({
16
- message: `Collections updated successfully with ${operations.length} operation(s)`,
17
- collections: response.rawData,
18
- appliedOperations: operations,
19
- });
20
- }
21
- catch (error) {
22
- return handleMcpToolError(error, "Collections Patch");
23
- }
24
- });
25
- };
@@ -1,33 +0,0 @@
1
- import { z } from "zod";
2
- import { createMapiClient } from "../clients/kontentClients.js";
3
- import { patchOperationsSchema } from "../schemas/patchSchemas/contentTypePatchSchemas.js";
4
- import { handleMcpToolError } from "../utils/errorHandler.js";
5
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
6
- export const registerTool = (server) => {
7
- server.tool("patch-content-type-mapi", "Update Kontent.ai content type using patch operations. Call get-patch-guide first for operations reference.", {
8
- id: z.guid(),
9
- operations: patchOperationsSchema.describe(`Patch operations array. CRITICAL: Always call get-type-mapi first.
10
- - Use addInto/remove for arrays, replace for primitives/objects
11
- - Only one url_slug element allowed per content type
12
- - To remove content groups: set ALL elements' content_group to null AND remove ALL groups in one request
13
- - URL slug with snippet: add snippet element first, then url_slug with depends_on reference`),
14
- }, async ({ id, operations }, { authInfo: { token, clientId } = {} }) => {
15
- const client = createMapiClient(clientId, token);
16
- try {
17
- // Apply patch operations using the modifyContentType method
18
- const response = await client
19
- .modifyContentType()
20
- .byTypeId(id)
21
- .withData(operations)
22
- .toPromise();
23
- return createMcpToolSuccessResponse({
24
- message: `Content type updated successfully with ${operations.length} operation(s)`,
25
- contentType: response.rawData,
26
- appliedOperations: operations,
27
- });
28
- }
29
- catch (error) {
30
- return handleMcpToolError(error, `Content Type Patch`);
31
- }
32
- });
33
- };
@@ -1,24 +0,0 @@
1
- import { createMapiClient } from "../clients/kontentClients.js";
2
- import { patchLanguageSchema } from "../schemas/languageSchemas.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("patch-language-mapi", "Update Kontent.ai language using replace operations. Call get-patch-guide first. Only active languages can be modified - to activate/deactivate, use the Kontent.ai web UI.", patchLanguageSchema.shape, async ({ languageId, operations }, { authInfo: { token, clientId } = {} }) => {
7
- const client = createMapiClient(clientId, token);
8
- try {
9
- const response = await client
10
- .modifyLanguage()
11
- .byLanguageId(languageId)
12
- .withData(operations)
13
- .toPromise();
14
- return createMcpToolSuccessResponse({
15
- message: `Language updated with ${operations.length} operation(s)`,
16
- language: response.rawData,
17
- appliedOperations: operations,
18
- });
19
- }
20
- catch (error) {
21
- return handleMcpToolError(error, "Language Patch");
22
- }
23
- });
24
- };
@@ -1,28 +0,0 @@
1
- import { z } from "zod";
2
- import { createMapiClient } from "../clients/kontentClients.js";
3
- import { spacePatchOperationsSchema } from "../schemas/spaceSchemas.js";
4
- import { handleMcpToolError } from "../utils/errorHandler.js";
5
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
6
- export const registerTool = (server) => {
7
- server.tool("patch-space-mapi", "Patch Kontent.ai space using replace operations. Call get-patch-guide first for operations reference.", {
8
- id: z.guid(),
9
- operations: spacePatchOperationsSchema,
10
- }, async ({ id, operations }, { authInfo: { token, clientId } = {} }) => {
11
- const client = createMapiClient(clientId, token);
12
- try {
13
- const response = await client
14
- .modifySpace()
15
- .bySpaceId(id)
16
- .withData(operations)
17
- .toPromise();
18
- return createMcpToolSuccessResponse({
19
- message: `Space updated successfully with ${operations.length} operation(s)`,
20
- space: response.rawData,
21
- appliedOperations: operations,
22
- });
23
- }
24
- catch (error) {
25
- return handleMcpToolError(error, "Space Modification");
26
- }
27
- });
28
- };
@@ -1,28 +0,0 @@
1
- import { z } from "zod";
2
- import { createMapiClient } from "../clients/kontentClients.js";
3
- import { taxonomyPatchOperationsSchema } from "../schemas/patchSchemas/taxonomyPatchSchemas.js";
4
- import { handleMcpToolError } from "../utils/errorHandler.js";
5
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
6
- export const registerTool = (server) => {
7
- server.tool("patch-taxonomy-group-mapi", "Update Kontent.ai taxonomy group using patch operations (addInto, move, remove, replace). Call get-patch-guide first for operations reference.", {
8
- id: z.guid(),
9
- operations: taxonomyPatchOperationsSchema.describe("Patch operations array. Call get-taxonomy-group-mapi first. Use addInto to add terms (with optional reference for parent), move to reorder/nest terms (before/after/under - mutually exclusive), remove to delete terms, replace for name/codename/terms."),
10
- }, async ({ id, operations }, { authInfo: { token, clientId } = {} }) => {
11
- const client = createMapiClient(clientId, token);
12
- try {
13
- const response = await client
14
- .modifyTaxonomy()
15
- .byTaxonomyId(id)
16
- .withData(operations)
17
- .toPromise();
18
- return createMcpToolSuccessResponse({
19
- message: `Taxonomy group updated with ${operations.length} operation(s)`,
20
- taxonomyGroup: response.rawData,
21
- appliedOperations: operations,
22
- });
23
- }
24
- catch (error) {
25
- return handleMcpToolError(error, "Taxonomy Group Patch");
26
- }
27
- });
28
- };
@@ -1,30 +0,0 @@
1
- import { z } from "zod";
2
- import { createMapiClient } from "../clients/kontentClients.js";
3
- import { snippetPatchOperationsSchema } from "../schemas/patchSchemas/snippetPatchSchemas.js";
4
- import { handleMcpToolError } from "../utils/errorHandler.js";
5
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
6
- export const registerTool = (server) => {
7
- server.tool("patch-type-snippet-mapi", "Update Kontent.ai content type snippet using patch operations (move, addInto, remove, replace). Call get-patch-guide first for operations reference.", {
8
- id: z.guid(),
9
- operations: snippetPatchOperationsSchema.describe(`Patch operations array. CRITICAL: Always call get-type-snippet-mapi first.
10
- - Use addInto/remove for arrays, replace for primitives/objects
11
- - Snippets cannot contain: content_groups, snippet, or url_slug elements`),
12
- }, async ({ id, operations }, { authInfo: { token, clientId } = {} }) => {
13
- const client = createMapiClient(clientId, token);
14
- try {
15
- const response = await client
16
- .modifyContentTypeSnippet()
17
- .byTypeId(id)
18
- .withData(operations)
19
- .toPromise();
20
- return createMcpToolSuccessResponse({
21
- message: `Content type snippet updated successfully with ${operations.length} operation(s)`,
22
- snippet: response.rawData,
23
- appliedOperations: operations,
24
- });
25
- }
26
- catch (error) {
27
- return handleMcpToolError(error, "Content Type Snippet Patch");
28
- }
29
- });
30
- };
@@ -1,73 +0,0 @@
1
- import { z } from "zod";
2
- import { createMapiClient } from "../clients/kontentClients.js";
3
- import { handleMcpToolError } from "../utils/errorHandler.js";
4
- import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
5
- export const registerTool = (server) => {
6
- server.tool("publish-variant-mapi", "Publish or schedule Kontent.ai variant. For scheduling, verify current UTC time before using scheduledTo.", {
7
- itemId: z.guid().describe("Content item UUID"),
8
- languageId: z
9
- .guid()
10
- .describe("Language variant UUID (default: 00000000-0000-0000-0000-000000000000)"),
11
- scheduledTo: z.iso
12
- .datetime({ offset: true })
13
- .optional()
14
- .describe("ISO 8601 datetime for scheduled publish (omit for immediate)"),
15
- displayTimezone: z
16
- .string()
17
- .optional()
18
- .describe("Timezone for UI display (e.g., America/New_York, UTC)"),
19
- }, async ({ itemId, languageId, scheduledTo, displayTimezone }, { authInfo: { token, clientId } = {} }) => {
20
- const client = createMapiClient(clientId, token);
21
- try {
22
- // Validate that displayTimezone can only be used with scheduledTo
23
- if (displayTimezone && !scheduledTo) {
24
- throw new Error("The 'displayTimezone' parameter can only be used in combination with 'scheduledTo' parameter for scheduled publishing.");
25
- }
26
- let action;
27
- let message;
28
- if (scheduledTo) {
29
- // Scheduled publishing
30
- const requestData = {
31
- scheduled_to: scheduledTo,
32
- };
33
- // Add display_timezone if provided
34
- if (displayTimezone) {
35
- requestData.display_timezone = displayTimezone;
36
- }
37
- await client
38
- .publishLanguageVariant()
39
- .byItemId(itemId)
40
- .byLanguageId(languageId)
41
- .withData(requestData)
42
- .toPromise();
43
- action = "scheduled";
44
- message = `Successfully scheduled language variant '${languageId}' for content item '${itemId}' to be published at '${scheduledTo}'${displayTimezone ? ` (timezone: ${displayTimezone})` : ""}.`;
45
- }
46
- else {
47
- // Immediate publishing
48
- await client
49
- .publishLanguageVariant()
50
- .byItemId(itemId)
51
- .byLanguageId(languageId)
52
- .withoutData()
53
- .toPromise();
54
- action = "published";
55
- message = `Successfully published language variant '${languageId}' for content item '${itemId}'. The content is now live and available through Delivery API.`;
56
- }
57
- return createMcpToolSuccessResponse({
58
- message,
59
- result: {
60
- itemId,
61
- languageId,
62
- scheduledTo: scheduledTo || null,
63
- displayTimezone: displayTimezone || null,
64
- action,
65
- timestamp: new Date().toISOString(),
66
- },
67
- });
68
- }
69
- catch (error) {
70
- return handleMcpToolError(error, "Publish/Schedule Language Variant");
71
- }
72
- });
73
- };