@kontent-ai/mcp-server 0.21.1 → 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.
|
@@ -4,6 +4,12 @@ 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
|
|
|
@@ -83,11 +89,17 @@ export const registerTool = (server) => {
|
|
|
83
89
|
.get()
|
|
84
90
|
.withAction(`projects/${environmentId}/early-access/ai-operation-result/${operationId}`)
|
|
85
91
|
.toPromise();
|
|
86
|
-
|
|
92
|
+
const [response] = pollResponse.data;
|
|
93
|
+
if (response.type === "cumulated-result-v1" &&
|
|
94
|
+
!response.result?.isFinished) {
|
|
95
|
+
throw new OperationResultIncompleteError();
|
|
96
|
+
}
|
|
97
|
+
return response;
|
|
87
98
|
}
|
|
88
99
|
catch (error) {
|
|
89
|
-
if (error?.response?.status === 404
|
|
90
|
-
|
|
100
|
+
if (error?.response?.status === 404 ||
|
|
101
|
+
error instanceof OperationResultIncompleteError) {
|
|
102
|
+
throw error;
|
|
91
103
|
}
|
|
92
104
|
throw new AbortError(error);
|
|
93
105
|
}
|