@kontent-ai/mcp-server 0.21.0 → 0.21.2
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.
|
@@ -149,8 +149,8 @@ All MCP tools have been optimized to work with internal IDs for maximum efficien
|
|
|
149
149
|
|
|
150
150
|
### Content Search Tools
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
- **
|
|
154
|
-
- **
|
|
152
|
+
**CRITICAL DISTINCTION**:
|
|
153
|
+
- **search-variants-mapi**: Finds content WHERE THE MAIN TOPIC matches a concept (e.g., "articles about wildlife")
|
|
154
|
+
- **filter-variants-mapi**: Finds SPECIFIC WORDS anywhere in content, regardless of topic (e.g., brand compliance, detecting prohibited terms in any content)
|
|
155
155
|
|
|
156
|
-
See each tool's description for detailed usage guidelines
|
|
156
|
+
See each tool's description for detailed usage guidelines.`;
|
|
@@ -7,11 +7,16 @@ export const registerTool = (server) => {
|
|
|
7
7
|
server.tool("filter-variants-mapi", `Filter Kontent.ai language variants of content items using Management API.
|
|
8
8
|
|
|
9
9
|
USE FOR:
|
|
10
|
-
- EXACT keyword matching: finding specific words, phrases, names, codes, or IDs in content
|
|
11
|
-
|
|
10
|
+
- EXACT keyword matching: finding specific words, phrases, names, codes, or IDs anywhere in content, regardless of overall topic
|
|
11
|
+
✓ Example: 'find items containing rabbit' → search 'rabbit'
|
|
12
|
+
- Brand guideline compliance: detecting prohibited terms across all content
|
|
13
|
+
✓ Example: Search "hunt beast prey" to find content containing ANY of these terms (natural OR operator)
|
|
12
14
|
- CAN expand concepts to keywords when using filter (e.g., "neurology-related" → "neurology neurological brain nervous system")
|
|
15
|
+
- Advanced filtering by content type, contributors, workflow steps, taxonomies etc
|
|
13
16
|
- Also use as fallback when AI search is unavailable
|
|
14
|
-
- Optionally includes full content of variants with include_content parameter
|
|
17
|
+
- Optionally includes full content of variants with include_content parameter
|
|
18
|
+
|
|
19
|
+
BEST FOR: Finding needles in haystacks - specific words in otherwise unrelated content. Multiple search terms use OR logic.`, filterVariantsSchema.shape, async ({ search_phrase, content_types, contributors, has_no_contributors, completion_statuses, language, workflow_steps, taxonomy_groups, order_by, order_direction, include_content, }, { authInfo: { token, clientId } = {} }) => {
|
|
15
20
|
try {
|
|
16
21
|
const environmentId = clientId ?? process.env.KONTENT_ENVIRONMENT_ID;
|
|
17
22
|
if (!environmentId) {
|
|
@@ -4,9 +4,15 @@ import { searchOperationSchema } from "../schemas/searchOperationSchemas.js";
|
|
|
4
4
|
import { handleMcpToolError } from "../utils/errorHandler.js";
|
|
5
5
|
import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
|
|
6
6
|
import { throwError } from "../utils/throwError.js";
|
|
7
|
+
class OperationResultIncompleteError extends Error {
|
|
8
|
+
constructor() {
|
|
9
|
+
super("AI operation result is incomplete");
|
|
10
|
+
this.name = "OperationResultIncompleteError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
7
13
|
export const registerTool = (server) => {
|
|
8
14
|
server.tool("search-variants-mapi", `AI-powered semantic search for finding Kontent.ai content by meaning, concepts, themes, and content similarity in a specific language variant. This tool uses vector database and AI to enable searching by meaning and similarity rather than exact keyword matching.
|
|
9
|
-
|
|
15
|
+
|
|
10
16
|
CRITICAL REQUIREMENTS:
|
|
11
17
|
- The AI search feature may not be available for all Kontent.ai environments
|
|
12
18
|
- If you receive an "unavailable" status response, DO NOT attempt to use this tool again in the same session
|
|
@@ -14,12 +20,24 @@ export const registerTool = (server) => {
|
|
|
14
20
|
- Requires language variant filter parameter (e.g., default language '00000000-0000-0000-0000-000000000000')
|
|
15
21
|
- The tool always RETURNS ONLY TOP 50 most relevant items at max
|
|
16
22
|
- Limited filtering options (only by variant ID) - use filter-variants-mapi for advanced filtering by content types, workflow steps, taxonomies, etc.
|
|
17
|
-
|
|
23
|
+
|
|
18
24
|
USE FOR:
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
25
|
+
- Finding content WHERE THE OVERALL TOPIC/THEME matches a concept
|
|
26
|
+
✓ Example: "fairy tales" → finds articles primarily about fairy tales
|
|
27
|
+
✓ Example: "beverage temperature control" → finds content focused on keeping drinks cold/hot
|
|
28
|
+
- Content similarity: Finding articles with similar overall themes
|
|
29
|
+
- Thematic content discovery when the main subject matter is what you're looking for
|
|
30
|
+
|
|
31
|
+
DO NOT USE FOR:
|
|
32
|
+
- Finding specific words scattered in otherwise unrelated content
|
|
33
|
+
✗ Example: Finding "challenge" term in articles about various topics (use filter-variants-mapi)
|
|
34
|
+
- Brand guideline violations or prohibited term detection (use filter-variants-mapi)
|
|
35
|
+
- Compliance audits looking for specific keywords (use filter-variants-mapi)
|
|
36
|
+
- Finding exhaustive and exact number of results (use filter-variants-mapi)
|
|
37
|
+
|
|
38
|
+
CRITICAL: This is SEMANTIC search for topic matching. Pass natural language concepts AS-IS. DO NOT generate keyword lists or concatenate multiple keywords.
|
|
39
|
+
✓ CORRECT: "animal predators" or "articles about temperature control"
|
|
40
|
+
✗ WRONG: "animal beast creature wild hunt predator prey attack"`, searchOperationSchema.shape, async ({ searchPhrase, filter }, { authInfo: { token, clientId } = {} }) => {
|
|
23
41
|
try {
|
|
24
42
|
const environmentId = clientId ?? process.env.KONTENT_ENVIRONMENT_ID;
|
|
25
43
|
if (!environmentId) {
|
|
@@ -71,11 +89,17 @@ export const registerTool = (server) => {
|
|
|
71
89
|
.get()
|
|
72
90
|
.withAction(`projects/${environmentId}/early-access/ai-operation-result/${operationId}`)
|
|
73
91
|
.toPromise();
|
|
74
|
-
|
|
92
|
+
const [response] = pollResponse.data;
|
|
93
|
+
if (response.type === "cumulated-result-v1" &&
|
|
94
|
+
!response.result?.isFinished) {
|
|
95
|
+
throw new OperationResultIncompleteError();
|
|
96
|
+
}
|
|
97
|
+
return response;
|
|
75
98
|
}
|
|
76
99
|
catch (error) {
|
|
77
|
-
if (error?.response?.status === 404
|
|
78
|
-
|
|
100
|
+
if (error?.response?.status === 404 ||
|
|
101
|
+
error instanceof OperationResultIncompleteError) {
|
|
102
|
+
throw error;
|
|
79
103
|
}
|
|
80
104
|
throw new AbortError(error);
|
|
81
105
|
}
|