@kontent-ai/mcp-server 0.30.1 → 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.
- package/README.md +57 -61
- package/build/schemas/bulkGetItemsWithVariantsSchemas.js +1 -1
- package/build/schemas/contentItemSchemas.js +1 -1
- package/build/schemas/filterVariantSchemas.js +8 -3
- package/build/schemas/searchOperationSchemas.js +2 -1
- package/build/server.js +4 -112
- package/build/test/bm25/bm25.js +47 -0
- package/build/test/bm25/toolSearchBm25.spec.js +874 -0
- package/build/tools/bulk-get-content-item-variants.js +31 -0
- package/build/tools/change-content-item-variant-workflow-step.js +35 -0
- package/build/tools/create-content-item-variant.js +44 -0
- package/build/tools/create-content-item.js +47 -0
- package/build/tools/create-content-type-snippet.js +34 -0
- package/build/tools/create-content-type.js +37 -0
- package/build/tools/create-language.js +24 -0
- package/build/tools/create-new-content-item-variant-version.js +27 -0
- package/build/tools/create-space.js +22 -0
- package/build/tools/create-taxonomy-group.js +18 -0
- package/build/tools/create-workflow.js +23 -0
- package/build/tools/delete-content-item-variant.js +25 -0
- package/build/tools/delete-content-item.js +23 -0
- package/build/tools/delete-content-type-snippet.js +19 -0
- package/build/tools/delete-content-type.js +23 -0
- package/build/tools/delete-space.js +19 -0
- package/build/tools/delete-taxonomy-group.js +19 -0
- package/build/tools/delete-workflow.js +19 -0
- package/build/tools/get-asset.js +17 -0
- package/build/tools/get-content-item-translations.js +20 -0
- package/build/tools/get-content-item-variant.js +22 -0
- package/build/tools/get-content-item.js +17 -0
- package/build/tools/get-content-type-snippet.js +20 -0
- package/build/tools/get-content-type.js +17 -0
- package/build/tools/get-patch-guide.js +12 -12
- package/build/tools/get-published-content-item-variant-version.js +23 -0
- package/build/tools/get-taxonomy-group.js +17 -0
- package/build/tools/index.js +106 -0
- package/build/tools/list-asset-folders.js +14 -0
- package/build/tools/list-assets.js +23 -0
- package/build/tools/list-collections.js +14 -0
- package/build/tools/list-content-item-variants.js +50 -0
- package/build/tools/list-content-type-snippets.js +23 -0
- package/build/tools/list-content-types.js +23 -0
- package/build/tools/list-languages.js +24 -0
- package/build/tools/list-roles.js +14 -0
- package/build/tools/list-spaces.js +14 -0
- package/build/tools/list-taxonomy-groups.js +23 -0
- package/build/tools/list-workflows.js +14 -0
- package/build/tools/patch-asset-folders.js +25 -0
- package/build/tools/patch-collections.js +25 -0
- package/build/tools/patch-content-type-snippet.js +30 -0
- package/build/tools/patch-content-type.js +33 -0
- package/build/tools/patch-language.js +24 -0
- package/build/tools/patch-space.js +28 -0
- package/build/tools/patch-taxonomy-group.js +28 -0
- package/build/tools/publish-content-item-variant.js +72 -0
- package/build/tools/referencedToolNames.js +10 -0
- package/build/tools/search-content-item-variants.js +108 -0
- package/build/tools/toolDefinition.js +1 -0
- package/build/tools/unpublish-content-item-variant.js +72 -0
- package/build/tools/update-asset.js +23 -0
- package/build/tools/update-content-item-variant.js +36 -0
- package/build/tools/update-content-item.js +74 -0
- package/build/tools/update-workflow.js +31 -0
- package/package.json +18 -17
- package/build/tools/add-content-item-mapi.js +0 -47
- package/build/tools/add-content-type-mapi.js +0 -38
- package/build/tools/add-content-type-snippet-mapi.js +0 -35
- package/build/tools/add-language-mapi.js +0 -25
- package/build/tools/add-space-mapi.js +0 -23
- package/build/tools/add-taxonomy-group-mapi.js +0 -19
- package/build/tools/add-workflow-mapi.js +0 -24
- package/build/tools/bulk-get-items-variants-mapi.js +0 -31
- package/build/tools/change-variant-workflow-step-mapi.js +0 -36
- package/build/tools/create-language-variant-mapi.js +0 -44
- package/build/tools/create-variant-version-mapi.js +0 -28
- package/build/tools/delete-content-item-mapi.js +0 -24
- package/build/tools/delete-content-type-mapi.js +0 -24
- package/build/tools/delete-language-variant-mapi.js +0 -26
- package/build/tools/delete-space-mapi.js +0 -20
- package/build/tools/delete-taxonomy-group-mapi.js +0 -20
- package/build/tools/delete-type-snippet-mapi.js +0 -23
- package/build/tools/delete-workflow-mapi.js +0 -20
- package/build/tools/filter-variants-mapi.js +0 -49
- package/build/tools/get-asset-mapi.js +0 -21
- package/build/tools/get-item-mapi.js +0 -21
- package/build/tools/get-latest-variant-mapi.js +0 -23
- package/build/tools/get-published-variant-mapi.js +0 -24
- package/build/tools/get-taxonomy-group-mapi.js +0 -21
- package/build/tools/get-type-mapi.js +0 -21
- package/build/tools/get-type-snippet-mapi.js +0 -21
- package/build/tools/list-asset-folders-mapi.js +0 -15
- package/build/tools/list-assets-mapi.js +0 -24
- package/build/tools/list-collections-mapi.js +0 -15
- package/build/tools/list-content-type-snippets-mapi.js +0 -24
- package/build/tools/list-content-types-mapi.js +0 -24
- package/build/tools/list-languages-mapi.js +0 -24
- package/build/tools/list-roles-mapi.js +0 -15
- package/build/tools/list-spaces-mapi.js +0 -15
- package/build/tools/list-taxonomy-groups-mapi.js +0 -24
- package/build/tools/list-variants-collection-mapi.js +0 -26
- package/build/tools/list-variants-components-type-mapi.js +0 -26
- package/build/tools/list-variants-item-mapi.js +0 -21
- package/build/tools/list-variants-space-mapi.js +0 -24
- package/build/tools/list-variants-type-mapi.js +0 -26
- package/build/tools/list-workflows-mapi.js +0 -15
- package/build/tools/patch-asset-folders-mapi.js +0 -25
- package/build/tools/patch-collections-mapi.js +0 -25
- package/build/tools/patch-content-type-mapi.js +0 -33
- package/build/tools/patch-language-mapi.js +0 -24
- package/build/tools/patch-space-mapi.js +0 -28
- package/build/tools/patch-taxonomy-group-mapi.js +0 -28
- package/build/tools/patch-type-snippet-mapi.js +0 -30
- package/build/tools/publish-variant-mapi.js +0 -73
- package/build/tools/search-variants-mapi.js +0 -95
- package/build/tools/unpublish-variant-mapi.js +0 -73
- package/build/tools/update-asset-mapi.js +0 -24
- package/build/tools/update-content-item-mapi.js +0 -74
- package/build/tools/update-language-variant-mapi.js +0 -37
- package/build/tools/update-workflow-mapi.js +0 -32
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createMapiClient } from "../clients/kontentClients.js";
|
|
2
|
-
import { taxonomyGroupSchemas } from "../schemas/taxonomySchemas.js";
|
|
3
|
-
import { handleMcpToolError } from "../utils/errorHandler.js";
|
|
4
|
-
import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
|
|
5
|
-
export const registerTool = (server) => {
|
|
6
|
-
server.tool("add-taxonomy-group-mapi", "Add new Kontent.ai taxonomy group", taxonomyGroupSchemas, async (taxonomyGroup, { authInfo: { token, clientId } = {} }) => {
|
|
7
|
-
const client = createMapiClient(clientId, token);
|
|
8
|
-
try {
|
|
9
|
-
const response = await client
|
|
10
|
-
.addTaxonomy()
|
|
11
|
-
.withData(taxonomyGroup)
|
|
12
|
-
.toPromise();
|
|
13
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
return handleMcpToolError(error, "Taxonomy Group Creation");
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createMapiClient } from "../clients/kontentClients.js";
|
|
2
|
-
import { workflowInputSchema } from "../schemas/workflowSchemas.js";
|
|
3
|
-
import { handleMcpToolError } from "../utils/errorHandler.js";
|
|
4
|
-
import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
|
|
5
|
-
export const registerTool = (server) => {
|
|
6
|
-
server.tool("add-workflow-mapi", "Add new Kontent.ai workflow", workflowInputSchema.shape, async ({ name, codename, scopes, steps, published_step, archived_step }, { authInfo: { token, clientId } = {} }) => {
|
|
7
|
-
const client = createMapiClient(clientId, token);
|
|
8
|
-
const data = {
|
|
9
|
-
name,
|
|
10
|
-
codename,
|
|
11
|
-
scopes,
|
|
12
|
-
steps,
|
|
13
|
-
published_step,
|
|
14
|
-
archived_step,
|
|
15
|
-
};
|
|
16
|
-
try {
|
|
17
|
-
const response = await client.addWorkflow().withData(data).toPromise();
|
|
18
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
return handleMcpToolError(error, "Workflow Creation");
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { createMapiClient } from "../clients/kontentClients.js";
|
|
2
|
-
import { bulkGetItemsWithVariantsSchema } from "../schemas/bulkGetItemsWithVariantsSchemas.js";
|
|
3
|
-
import { handleMcpToolError } from "../utils/errorHandler.js";
|
|
4
|
-
import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
|
|
5
|
-
import { throwError } from "../utils/throwError.js";
|
|
6
|
-
export const registerTool = (server) => {
|
|
7
|
-
server.tool("bulk-get-items-variants-mapi", "Bulk get Kontent.ai content items with their language variants by item and language reference pairs. Items without a variant in the requested language return the item without the variant property.", bulkGetItemsWithVariantsSchema.shape, async ({ variants, continuation_token }, { authInfo: { token, clientId } = {} }) => {
|
|
8
|
-
try {
|
|
9
|
-
const environmentId = clientId ?? process.env.KONTENT_ENVIRONMENT_ID;
|
|
10
|
-
if (!environmentId) {
|
|
11
|
-
throwError("Missing required environment ID");
|
|
12
|
-
}
|
|
13
|
-
const client = createMapiClient(environmentId, token);
|
|
14
|
-
const query = client.bulkGetItemsWithVariants().withData({
|
|
15
|
-
variants,
|
|
16
|
-
});
|
|
17
|
-
const response = await (continuation_token
|
|
18
|
-
? query.xContinuationToken(continuation_token)
|
|
19
|
-
: query).toPromise();
|
|
20
|
-
return createMcpToolSuccessResponse({
|
|
21
|
-
data: response.rawData.data,
|
|
22
|
-
pagination: {
|
|
23
|
-
continuation_token: response.data.pagination.continuationToken,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
return handleMcpToolError(error, "Bulk Get Items With Variants");
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
};
|
|
@@ -1,36 +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("change-variant-workflow-step-mapi", "Change Kontent.ai variant workflow step", {
|
|
7
|
-
itemId: z.guid().describe("Content item ID"),
|
|
8
|
-
languageId: z.guid().describe("Language variant ID"),
|
|
9
|
-
workflowId: z.guid().describe("Workflow ID"),
|
|
10
|
-
workflowStepId: z.guid().describe("Target workflow step ID"),
|
|
11
|
-
}, async ({ itemId, languageId, workflowId, workflowStepId }, { authInfo: { token, clientId } = {} }) => {
|
|
12
|
-
const client = createMapiClient(clientId, token);
|
|
13
|
-
try {
|
|
14
|
-
const response = await client
|
|
15
|
-
.changeWorkflowOfLanguageVariant()
|
|
16
|
-
.byItemId(itemId)
|
|
17
|
-
.byLanguageId(languageId)
|
|
18
|
-
.withData({
|
|
19
|
-
workflow_identifier: {
|
|
20
|
-
id: workflowId,
|
|
21
|
-
},
|
|
22
|
-
step_identifier: {
|
|
23
|
-
id: workflowStepId,
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
.toPromise();
|
|
27
|
-
return createMcpToolSuccessResponse({
|
|
28
|
-
message: `Successfully changed workflow step of language variant '${languageId}' for content item '${itemId}' to workflow step '${workflowStepId}'`,
|
|
29
|
-
result: response.rawData,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
return handleMcpToolError(error, "Workflow Step Change");
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { createMapiClient } from "../clients/kontentClients.js";
|
|
3
|
-
import { languageVariantElementSchema } from "../schemas/contentItemSchemas.js";
|
|
4
|
-
import { handleMcpToolError } from "../utils/errorHandler.js";
|
|
5
|
-
import { extractUserIdFromToken } from "../utils/extractUserIdFromToken.js";
|
|
6
|
-
import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
|
|
7
|
-
export const registerTool = (server) => {
|
|
8
|
-
server.tool("create-language-variant-mapi", "Create Kontent.ai variant. Element values must fulfill limitations and guidelines defined in content type.", {
|
|
9
|
-
itemId: z.string().describe("Content item ID"),
|
|
10
|
-
languageId: z
|
|
11
|
-
.string()
|
|
12
|
-
.describe("Language variant ID (default: 00000000-0000-0000-0000-000000000000)"),
|
|
13
|
-
elements: z
|
|
14
|
-
.array(languageVariantElementSchema)
|
|
15
|
-
.describe("Content elements array"),
|
|
16
|
-
workflow_step_id: z.string().optional().describe("Workflow step ID"),
|
|
17
|
-
}, async ({ itemId, languageId, elements, workflow_step_id }, { authInfo: { token, clientId } = {} }) => {
|
|
18
|
-
const client = createMapiClient(clientId, token);
|
|
19
|
-
const data = {
|
|
20
|
-
elements,
|
|
21
|
-
};
|
|
22
|
-
if (workflow_step_id) {
|
|
23
|
-
data.workflow_step = { id: workflow_step_id };
|
|
24
|
-
}
|
|
25
|
-
if (token) {
|
|
26
|
-
const userId = extractUserIdFromToken(token);
|
|
27
|
-
if (userId) {
|
|
28
|
-
data.contributors = [{ id: userId }];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
const response = await client
|
|
33
|
-
.upsertLanguageVariant()
|
|
34
|
-
.byItemId(itemId)
|
|
35
|
-
.byLanguageId(languageId)
|
|
36
|
-
.withData(() => data)
|
|
37
|
-
.toPromise();
|
|
38
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
return handleMcpToolError(error, "Language Variant Create");
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
};
|
|
@@ -1,28 +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("create-variant-version-mapi", "Create new version of Kontent.ai variant", {
|
|
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
|
-
}, async ({ itemId, languageId }, { authInfo: { token, clientId } = {} }) => {
|
|
12
|
-
const client = createMapiClient(clientId, token);
|
|
13
|
-
try {
|
|
14
|
-
const response = await client
|
|
15
|
-
.createNewVersionOfLanguageVariant()
|
|
16
|
-
.byItemId(itemId)
|
|
17
|
-
.byLanguageId(languageId)
|
|
18
|
-
.toPromise();
|
|
19
|
-
return createMcpToolSuccessResponse({
|
|
20
|
-
message: `Successfully created new version of language variant '${languageId}' for content item '${itemId}'`,
|
|
21
|
-
result: response.rawData,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
return handleMcpToolError(error, "Variant Version Creation");
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
};
|
|
@@ -1,24 +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("delete-content-item-mapi", "Delete Kontent.ai content item", {
|
|
7
|
-
id: z.string().describe("Item ID"),
|
|
8
|
-
}, async ({ id }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
const response = await client
|
|
12
|
-
.deleteContentItem()
|
|
13
|
-
.byItemId(id)
|
|
14
|
-
.toPromise();
|
|
15
|
-
return createMcpToolSuccessResponse({
|
|
16
|
-
message: `Content item '${id}' deleted successfully`,
|
|
17
|
-
deletedItem: response.rawData,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
return handleMcpToolError(error, "Content Item Deletion");
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -1,24 +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("delete-content-type-mapi", "Delete Kontent.ai content type by codename", {
|
|
7
|
-
codename: z.string().describe("Content type codename"),
|
|
8
|
-
}, async ({ codename }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
const response = await client
|
|
12
|
-
.deleteContentType()
|
|
13
|
-
.byTypeCodename(codename)
|
|
14
|
-
.toPromise();
|
|
15
|
-
return createMcpToolSuccessResponse({
|
|
16
|
-
message: `Content type '${codename}' deleted successfully`,
|
|
17
|
-
deletedType: response.rawData,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
return handleMcpToolError(error, "Content Type Deletion");
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -1,26 +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("delete-language-variant-mapi", "Delete Kontent.ai variant", {
|
|
7
|
-
itemId: z.string().describe("Item ID"),
|
|
8
|
-
languageId: z.string().describe("Language variant ID"),
|
|
9
|
-
}, async ({ itemId, languageId }, { authInfo: { token, clientId } = {} }) => {
|
|
10
|
-
const client = createMapiClient(clientId, token);
|
|
11
|
-
try {
|
|
12
|
-
const response = await client
|
|
13
|
-
.deleteLanguageVariant()
|
|
14
|
-
.byItemId(itemId)
|
|
15
|
-
.byLanguageId(languageId)
|
|
16
|
-
.toPromise();
|
|
17
|
-
return createMcpToolSuccessResponse({
|
|
18
|
-
message: `Language variant '${languageId}' of content item '${itemId}' deleted successfully`,
|
|
19
|
-
deletedVariant: response.rawData,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
return handleMcpToolError(error, "Language Variant Deletion");
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
};
|
|
@@ -1,20 +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("delete-space-mapi", "Delete Kontent.ai space by ID", {
|
|
7
|
-
id: z.guid(),
|
|
8
|
-
}, async ({ id }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
await client.deleteSpace().bySpaceId(id).toPromise();
|
|
12
|
-
return createMcpToolSuccessResponse({
|
|
13
|
-
message: `Space '${id}' deleted successfully`,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
return handleMcpToolError(error, "Space Deletion");
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
};
|
|
@@ -1,20 +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("delete-taxonomy-group-mapi", "Delete Kontent.ai taxonomy group by ID", {
|
|
7
|
-
id: z.guid(),
|
|
8
|
-
}, async ({ id }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
await client.deleteTaxonomy().byTaxonomyId(id).toPromise();
|
|
12
|
-
return createMcpToolSuccessResponse({
|
|
13
|
-
message: `Taxonomy group '${id}' deleted successfully`,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
return handleMcpToolError(error, "Taxonomy Group Deletion");
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
};
|
|
@@ -1,23 +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("delete-type-snippet-mapi", "Delete Kontent.ai content type snippet by codename", {
|
|
7
|
-
codename: z.string(),
|
|
8
|
-
}, async ({ codename }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
await client
|
|
12
|
-
.deleteContentTypeSnippet()
|
|
13
|
-
.byTypeCodename(codename)
|
|
14
|
-
.toPromise();
|
|
15
|
-
return createMcpToolSuccessResponse({
|
|
16
|
-
message: `Content type snippet '${codename}' deleted successfully`,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
return handleMcpToolError(error, "Content Type Snippet Deletion");
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
};
|
|
@@ -1,20 +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("delete-workflow-mapi", "Delete Kontent.ai workflow", {
|
|
7
|
-
id: z.guid().describe("Workflow ID"),
|
|
8
|
-
}, async ({ id }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
await client.deleteWorkflow().byWorkflowId(id).toPromise();
|
|
12
|
-
return createMcpToolSuccessResponse({
|
|
13
|
-
message: `Workflow '${id}' deleted successfully`,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
return handleMcpToolError(error, "Workflow Deletion");
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { createMapiClient } from "../clients/kontentClients.js";
|
|
2
|
-
import { filterVariantsSchema } from "../schemas/filterVariantSchemas.js";
|
|
3
|
-
import { handleMcpToolError } from "../utils/errorHandler.js";
|
|
4
|
-
import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
|
|
5
|
-
import { throwError } from "../utils/throwError.js";
|
|
6
|
-
export const registerTool = (server) => {
|
|
7
|
-
server.tool("filter-variants-mapi", "Filter Kontent.ai items with variants returning references (item ID + language ID). For EXACT keyword matching and compliance (terms use OR). Use bulk-get-items-variants-mapi to retrieve full content for matched items. Use search-variants-mapi for semantic/topic search.", filterVariantsSchema.shape, async ({ search_phrase, content_types, contributors, has_no_contributors, completion_statuses, language, workflow_steps, taxonomy_groups, spaces, collections, publishing_states, order_by, order_direction, continuation_token, }, { authInfo: { token, clientId } = {} }) => {
|
|
8
|
-
try {
|
|
9
|
-
const environmentId = clientId ?? process.env.KONTENT_ENVIRONMENT_ID;
|
|
10
|
-
if (!environmentId) {
|
|
11
|
-
throwError("Missing required environment ID");
|
|
12
|
-
}
|
|
13
|
-
const client = createMapiClient(environmentId, token);
|
|
14
|
-
const query = client.filterItemsWithVariants().withData({
|
|
15
|
-
filters: {
|
|
16
|
-
search_phrase,
|
|
17
|
-
content_types,
|
|
18
|
-
contributors,
|
|
19
|
-
has_no_contributors,
|
|
20
|
-
completion_statuses,
|
|
21
|
-
language,
|
|
22
|
-
workflow_steps,
|
|
23
|
-
taxonomy_groups,
|
|
24
|
-
spaces,
|
|
25
|
-
collections,
|
|
26
|
-
publishing_states,
|
|
27
|
-
},
|
|
28
|
-
order: order_by
|
|
29
|
-
? {
|
|
30
|
-
by: order_by,
|
|
31
|
-
direction: order_direction || "asc",
|
|
32
|
-
}
|
|
33
|
-
: undefined,
|
|
34
|
-
});
|
|
35
|
-
const response = await (continuation_token
|
|
36
|
-
? query.xContinuationToken(continuation_token)
|
|
37
|
-
: query).toPromise();
|
|
38
|
-
return createMcpToolSuccessResponse({
|
|
39
|
-
variants: response.rawData.variants,
|
|
40
|
-
pagination: {
|
|
41
|
-
continuation_token: response.data.pagination.continuationToken,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
return handleMcpToolError(error, "Variant Filter");
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
};
|
|
@@ -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("get-asset-mapi", "Get Kontent.ai asset. Assets are digital files (images, videos, documents) referenced in content.", {
|
|
7
|
-
assetId: z.string().describe("Asset ID"),
|
|
8
|
-
}, async ({ assetId }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
const response = await client
|
|
12
|
-
.viewAsset()
|
|
13
|
-
.byAssetId(assetId)
|
|
14
|
-
.toPromise();
|
|
15
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
return handleMcpToolError(error, "Asset Retrieval");
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
};
|
|
@@ -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("get-item-mapi", "Get Kontent.ai content item. Items are language-neutral containers; one item has multiple language variants.", {
|
|
7
|
-
id: z.string().describe("Item ID"),
|
|
8
|
-
}, async ({ id }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
const response = await client
|
|
12
|
-
.viewContentItem()
|
|
13
|
-
.byItemId(id)
|
|
14
|
-
.toPromise();
|
|
15
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
return handleMcpToolError(error, "Item Retrieval");
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
};
|
|
@@ -1,23 +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("get-latest-variant-mapi", "Get latest Kontent.ai language variant. Variants hold language-specific content; structure defined by content type and its snippets.", {
|
|
7
|
-
itemId: z.string().describe("Item ID"),
|
|
8
|
-
languageId: z.string().describe("Language variant ID"),
|
|
9
|
-
}, async ({ itemId, languageId }, { authInfo: { token, clientId } = {} }) => {
|
|
10
|
-
const client = createMapiClient(clientId, token);
|
|
11
|
-
try {
|
|
12
|
-
const response = await client
|
|
13
|
-
.viewLanguageVariant()
|
|
14
|
-
.byItemId(itemId)
|
|
15
|
-
.byLanguageId(languageId)
|
|
16
|
-
.toPromise();
|
|
17
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
return handleMcpToolError(error, "Latest Language Variant Retrieval");
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
};
|
|
@@ -1,24 +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("get-published-variant-mapi", "Get published Kontent.ai language variant. Variants hold language-specific content; structure defined by content type and its snippets.", {
|
|
7
|
-
itemId: z.string().describe("Item ID"),
|
|
8
|
-
languageId: z.string().describe("Language variant ID"),
|
|
9
|
-
}, async ({ itemId, languageId }, { authInfo: { token, clientId } = {} }) => {
|
|
10
|
-
const client = createMapiClient(clientId, token);
|
|
11
|
-
try {
|
|
12
|
-
const response = await client
|
|
13
|
-
.viewLanguageVariant()
|
|
14
|
-
.byItemId(itemId)
|
|
15
|
-
.byLanguageId(languageId)
|
|
16
|
-
.published()
|
|
17
|
-
.toPromise();
|
|
18
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
return handleMcpToolError(error, "Published Language Variant Retrieval");
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -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("get-taxonomy-group-mapi", "Get Kontent.ai taxonomy group. Taxonomy groups are hierarchical with tree-structured terms that can be nested to any depth for flexible content categorization.", {
|
|
7
|
-
id: z.guid(),
|
|
8
|
-
}, async ({ id }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
const response = await client
|
|
12
|
-
.getTaxonomy()
|
|
13
|
-
.byTaxonomyId(id)
|
|
14
|
-
.toPromise();
|
|
15
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
return handleMcpToolError(error, "Taxonomy Group Retrieval");
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
};
|
|
@@ -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("get-type-mapi", "Get Kontent.ai content type. Types define variant structure: field definitions, validation rules, and element types.", {
|
|
7
|
-
id: z.string().describe("Content type ID"),
|
|
8
|
-
}, async ({ id }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
const response = await client
|
|
12
|
-
.viewContentType()
|
|
13
|
-
.byTypeId(id)
|
|
14
|
-
.toPromise();
|
|
15
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
return handleMcpToolError(error, "Content Type Retrieval");
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
};
|
|
@@ -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("get-type-snippet-mapi", "Get Kontent.ai content type snippet. Snippets are reusable element sets included in content types via snippet element.", {
|
|
7
|
-
id: z.string().describe("Snippet ID"),
|
|
8
|
-
}, async ({ id }, { authInfo: { token, clientId } = {} }) => {
|
|
9
|
-
const client = createMapiClient(clientId, token);
|
|
10
|
-
try {
|
|
11
|
-
const response = await client
|
|
12
|
-
.viewContentTypeSnippet()
|
|
13
|
-
.byTypeId(id)
|
|
14
|
-
.toPromise();
|
|
15
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
return handleMcpToolError(error, "Content Type Snippet Retrieval");
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
};
|
|
@@ -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-asset-folders-mapi", "List all Kontent.ai asset folders", {}, async (_params, { authInfo: { token, clientId } = {} }) => {
|
|
6
|
-
const client = createMapiClient(clientId, token);
|
|
7
|
-
try {
|
|
8
|
-
const response = await client.listAssetFolders().toPromise();
|
|
9
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
10
|
-
}
|
|
11
|
-
catch (error) {
|
|
12
|
-
return handleMcpToolError(error, "Asset Folders Listing");
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createMapiClient } from "../clients/kontentClients.js";
|
|
2
|
-
import { listAssetsSchema } 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-assets-mapi", "Get all Kontent.ai assets (paginated). Assets are digital files (images, videos, documents) referenced in content.", listAssetsSchema.shape, async ({ continuation_token }, { authInfo: { token, clientId } = {} }) => {
|
|
7
|
-
const client = createMapiClient(clientId, token);
|
|
8
|
-
try {
|
|
9
|
-
const query = client.listAssets();
|
|
10
|
-
const response = await (continuation_token
|
|
11
|
-
? query.xContinuationToken(continuation_token)
|
|
12
|
-
: query).toPromise();
|
|
13
|
-
return createMcpToolSuccessResponse({
|
|
14
|
-
data: response.rawData.assets,
|
|
15
|
-
pagination: {
|
|
16
|
-
continuation_token: response.data.pagination.continuationToken,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
return handleMcpToolError(error, "Assets 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-collections-mapi", "Get all Kontent.ai collections. Collections organize content items into logical groups by team, brand, or project.", {}, async (_, { authInfo: { token, clientId } = {} }) => {
|
|
6
|
-
const client = createMapiClient(clientId, token);
|
|
7
|
-
try {
|
|
8
|
-
const response = await client.listCollections().toPromise();
|
|
9
|
-
return createMcpToolSuccessResponse(response.rawData);
|
|
10
|
-
}
|
|
11
|
-
catch (error) {
|
|
12
|
-
return handleMcpToolError(error, "Collections Listing");
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
};
|