noverload-mcp 0.6.0-beta.1 → 0.7.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/dist/client.d.ts +33 -21
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +327 -101
- package/dist/client.js.map +1 -1
- package/dist/llm-instructions.d.ts +87 -0
- package/dist/llm-instructions.d.ts.map +1 -0
- package/dist/llm-instructions.js +257 -0
- package/dist/llm-instructions.js.map +1 -0
- package/dist/tools/helpers/connections.d.ts +7 -0
- package/dist/tools/helpers/connections.d.ts.map +1 -0
- package/dist/tools/helpers/connections.js +85 -0
- package/dist/tools/helpers/connections.js.map +1 -0
- package/dist/tools/helpers/content-processing.d.ts +7 -0
- package/dist/tools/helpers/content-processing.d.ts.map +1 -0
- package/dist/tools/helpers/content-processing.js +136 -0
- package/dist/tools/helpers/content-processing.js.map +1 -0
- package/dist/tools/helpers/insights.d.ts +2 -0
- package/dist/tools/helpers/insights.d.ts.map +1 -0
- package/dist/tools/helpers/insights.js +62 -0
- package/dist/tools/helpers/insights.js.map +1 -0
- package/dist/tools/implementations/actions.d.ts +4 -0
- package/dist/tools/implementations/actions.d.ts.map +1 -0
- package/dist/tools/implementations/actions.js +73 -0
- package/dist/tools/implementations/actions.js.map +1 -0
- package/dist/tools/implementations/batch-get.d.ts +3 -0
- package/dist/tools/implementations/batch-get.d.ts.map +1 -0
- package/dist/tools/implementations/batch-get.js +102 -0
- package/dist/tools/implementations/batch-get.js.map +1 -0
- package/dist/tools/implementations/build-narrative.d.ts +3 -0
- package/dist/tools/implementations/build-narrative.d.ts.map +1 -0
- package/dist/tools/implementations/build-narrative.js +352 -0
- package/dist/tools/implementations/build-narrative.js.map +1 -0
- package/dist/tools/implementations/estimate-tokens.d.ts +3 -0
- package/dist/tools/implementations/estimate-tokens.d.ts.map +1 -0
- package/dist/tools/implementations/estimate-tokens.js +54 -0
- package/dist/tools/implementations/estimate-tokens.js.map +1 -0
- package/dist/tools/implementations/expand-search.d.ts +3 -0
- package/dist/tools/implementations/expand-search.d.ts.map +1 -0
- package/dist/tools/implementations/expand-search.js +223 -0
- package/dist/tools/implementations/expand-search.js.map +1 -0
- package/dist/tools/implementations/explore-topic.d.ts +3 -0
- package/dist/tools/implementations/explore-topic.d.ts.map +1 -0
- package/dist/tools/implementations/explore-topic.js +137 -0
- package/dist/tools/implementations/explore-topic.js.map +1 -0
- package/dist/tools/implementations/extract-frameworks.d.ts +3 -0
- package/dist/tools/implementations/extract-frameworks.d.ts.map +1 -0
- package/dist/tools/implementations/extract-frameworks.js +192 -0
- package/dist/tools/implementations/extract-frameworks.js.map +1 -0
- package/dist/tools/implementations/extract-insights.d.ts +3 -0
- package/dist/tools/implementations/extract-insights.d.ts.map +1 -0
- package/dist/tools/implementations/extract-insights.js +130 -0
- package/dist/tools/implementations/extract-insights.js.map +1 -0
- package/dist/tools/implementations/find-connections.d.ts +3 -0
- package/dist/tools/implementations/find-connections.d.ts.map +1 -0
- package/dist/tools/implementations/find-connections.js +106 -0
- package/dist/tools/implementations/find-connections.js.map +1 -0
- package/dist/tools/implementations/find-examples.d.ts +3 -0
- package/dist/tools/implementations/find-examples.d.ts.map +1 -0
- package/dist/tools/implementations/find-examples.js +242 -0
- package/dist/tools/implementations/find-examples.js.map +1 -0
- package/dist/tools/implementations/get-content.d.ts +3 -0
- package/dist/tools/implementations/get-content.d.ts.map +1 -0
- package/dist/tools/implementations/get-content.js +96 -0
- package/dist/tools/implementations/get-content.js.map +1 -0
- package/dist/tools/implementations/goals.d.ts +3 -0
- package/dist/tools/implementations/goals.d.ts.map +1 -0
- package/dist/tools/implementations/goals.js +22 -0
- package/dist/tools/implementations/goals.js.map +1 -0
- package/dist/tools/implementations/instructions.d.ts +3 -0
- package/dist/tools/implementations/instructions.d.ts.map +1 -0
- package/dist/tools/implementations/instructions.js +88 -0
- package/dist/tools/implementations/instructions.js.map +1 -0
- package/dist/tools/implementations/knowledge-graph.d.ts +3 -0
- package/dist/tools/implementations/knowledge-graph.d.ts.map +1 -0
- package/dist/tools/implementations/knowledge-graph.js +278 -0
- package/dist/tools/implementations/knowledge-graph.js.map +1 -0
- package/dist/tools/implementations/list-content.d.ts +3 -0
- package/dist/tools/implementations/list-content.d.ts.map +1 -0
- package/dist/tools/implementations/list-content.js +87 -0
- package/dist/tools/implementations/list-content.js.map +1 -0
- package/dist/tools/implementations/plan-query.d.ts +3 -0
- package/dist/tools/implementations/plan-query.d.ts.map +1 -0
- package/dist/tools/implementations/plan-query.js +63 -0
- package/dist/tools/implementations/plan-query.js.map +1 -0
- package/dist/tools/implementations/raw-content.d.ts +3 -0
- package/dist/tools/implementations/raw-content.d.ts.map +1 -0
- package/dist/tools/implementations/raw-content.js +208 -0
- package/dist/tools/implementations/raw-content.js.map +1 -0
- package/dist/tools/implementations/save-content.d.ts +3 -0
- package/dist/tools/implementations/save-content.d.ts.map +1 -0
- package/dist/tools/implementations/save-content.js +33 -0
- package/dist/tools/implementations/save-content.js.map +1 -0
- package/dist/tools/implementations/search.d.ts +3 -0
- package/dist/tools/implementations/search.d.ts.map +1 -0
- package/dist/tools/implementations/search.js +245 -0
- package/dist/tools/implementations/search.js.map +1 -0
- package/dist/tools/implementations/similar-content.d.ts +3 -0
- package/dist/tools/implementations/similar-content.d.ts.map +1 -0
- package/dist/tools/implementations/similar-content.js +64 -0
- package/dist/tools/implementations/similar-content.js.map +1 -0
- package/dist/tools/implementations/smart-sections.d.ts +3 -0
- package/dist/tools/implementations/smart-sections.d.ts.map +1 -0
- package/dist/tools/implementations/smart-sections.js +347 -0
- package/dist/tools/implementations/smart-sections.js.map +1 -0
- package/dist/tools/implementations/synthesize.d.ts +3 -0
- package/dist/tools/implementations/synthesize.d.ts.map +1 -0
- package/dist/tools/implementations/synthesize.js +148 -0
- package/dist/tools/implementations/synthesize.js.map +1 -0
- package/dist/tools/implementations/timeline.d.ts +3 -0
- package/dist/tools/implementations/timeline.d.ts.map +1 -0
- package/dist/tools/implementations/timeline.js +191 -0
- package/dist/tools/implementations/timeline.js.map +1 -0
- package/dist/tools/index-old.d.ts +16 -0
- package/dist/tools/index-old.d.ts.map +1 -0
- package/dist/tools/index-old.js +2176 -0
- package/dist/tools/index-old.js.map +1 -0
- package/dist/tools/index.d.ts +25 -14
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +57 -921
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/types.d.ts +22 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/package.json +5 -5
package/dist/client.d.ts
CHANGED
|
@@ -6,55 +6,55 @@ export interface ClientConfig {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const ContentSchema: z.ZodObject<{
|
|
8
8
|
id: z.ZodString;
|
|
9
|
-
userId: z.ZodString
|
|
9
|
+
userId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
10
10
|
url: z.ZodString;
|
|
11
|
-
title: z.ZodNullable<z.ZodString
|
|
12
|
-
description: z.ZodNullable<z.ZodString
|
|
13
|
-
contentType: z.ZodEnum<["youtube", "x_twitter", "reddit", "article", "pdf"]
|
|
14
|
-
status: z.ZodEnum<["pending", "processing", "completed", "failed"]
|
|
15
|
-
summary: z.ZodNullable<z.ZodAny
|
|
16
|
-
keyInsights: z.ZodNullable<z.ZodArray<z.ZodString, "many"
|
|
11
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
contentType: z.ZodDefault<z.ZodOptional<z.ZodEnum<["youtube", "x_twitter", "reddit", "article", "pdf"]>>>;
|
|
14
|
+
status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>>;
|
|
15
|
+
summary: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
16
|
+
keyInsights: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>>;
|
|
17
17
|
rawText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
18
|
tokenCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
19
19
|
ogImage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
20
|
processingMetadata: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
21
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many"
|
|
22
|
-
createdAt: z.ZodString
|
|
23
|
-
updatedAt: z.ZodString
|
|
21
|
+
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
22
|
+
createdAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
23
|
+
updatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
24
24
|
}, "strip", z.ZodTypeAny, {
|
|
25
25
|
id: string;
|
|
26
26
|
userId: string;
|
|
27
27
|
url: string;
|
|
28
|
-
title: string | null;
|
|
29
|
-
description: string | null;
|
|
30
28
|
contentType: "youtube" | "x_twitter" | "reddit" | "article" | "pdf";
|
|
31
29
|
status: "pending" | "processing" | "completed" | "failed";
|
|
32
30
|
keyInsights: string[] | null;
|
|
31
|
+
tags: string[];
|
|
33
32
|
createdAt: string;
|
|
34
33
|
updatedAt: string;
|
|
34
|
+
title?: string | null | undefined;
|
|
35
|
+
description?: string | null | undefined;
|
|
35
36
|
summary?: any;
|
|
36
37
|
rawText?: string | null | undefined;
|
|
37
38
|
tokenCount?: number | null | undefined;
|
|
38
39
|
ogImage?: string | null | undefined;
|
|
39
40
|
processingMetadata?: any;
|
|
40
|
-
tags?: string[] | undefined;
|
|
41
41
|
}, {
|
|
42
42
|
id: string;
|
|
43
|
-
userId: string;
|
|
44
43
|
url: string;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
createdAt: string;
|
|
51
|
-
updatedAt: string;
|
|
44
|
+
userId?: string | undefined;
|
|
45
|
+
title?: string | null | undefined;
|
|
46
|
+
description?: string | null | undefined;
|
|
47
|
+
contentType?: "youtube" | "x_twitter" | "reddit" | "article" | "pdf" | undefined;
|
|
48
|
+
status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
52
49
|
summary?: any;
|
|
50
|
+
keyInsights?: string[] | null | undefined;
|
|
53
51
|
rawText?: string | null | undefined;
|
|
54
52
|
tokenCount?: number | null | undefined;
|
|
55
53
|
ogImage?: string | null | undefined;
|
|
56
54
|
processingMetadata?: any;
|
|
57
55
|
tags?: string[] | undefined;
|
|
56
|
+
createdAt?: string | undefined;
|
|
57
|
+
updatedAt?: string | undefined;
|
|
58
58
|
}>;
|
|
59
59
|
export declare const ActionSchema: z.ZodObject<{
|
|
60
60
|
id: z.ZodString;
|
|
@@ -145,6 +145,16 @@ export declare class NoverloadClient {
|
|
|
145
145
|
dateTo?: string;
|
|
146
146
|
excludeDomains?: string[];
|
|
147
147
|
enableConceptExpansion?: boolean;
|
|
148
|
+
searchMode?: "any" | "all" | "phrase";
|
|
149
|
+
fuzzyMatch?: boolean;
|
|
150
|
+
}): Promise<any>;
|
|
151
|
+
private searchContentV1;
|
|
152
|
+
searchContentV2(params: {
|
|
153
|
+
query: string;
|
|
154
|
+
mode?: "smart" | "semantic" | "fulltext" | "any" | "all" | "phrase";
|
|
155
|
+
limit?: number;
|
|
156
|
+
contentTypes?: string[];
|
|
157
|
+
includeContent?: boolean;
|
|
148
158
|
}): Promise<any>;
|
|
149
159
|
estimateSearchTokens(query: string, limit?: number): Promise<any>;
|
|
150
160
|
synthesizeContent(params: {
|
|
@@ -155,10 +165,12 @@ export declare class NoverloadClient {
|
|
|
155
165
|
findConnections?: boolean;
|
|
156
166
|
maxSources?: number;
|
|
157
167
|
}): Promise<any>;
|
|
168
|
+
private synthesizeContentV1;
|
|
158
169
|
findSimilarContent(contentId: string, options?: {
|
|
159
170
|
limit?: number;
|
|
160
171
|
minSimilarity?: number;
|
|
161
172
|
}): Promise<any>;
|
|
162
173
|
batchGetContent(ids: string[], includeFullContent?: boolean): Promise<any>;
|
|
174
|
+
getEnrichedContent(ids: string[], includeFullContent?: boolean): Promise<any>;
|
|
163
175
|
}
|
|
164
176
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AAID,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBxB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUvB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;EAQrB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,qBAAa,eAAe;IAGd,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,OAAO,CAA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1
|
import { z } from "zod";
|
|
2
2
|
// Schema definitions matching your Noverload database
|
|
3
|
+
// Made more flexible to handle API variations
|
|
3
4
|
export const ContentSchema = z.object({
|
|
4
5
|
id: z.string(),
|
|
5
|
-
userId: z.string(),
|
|
6
|
+
userId: z.string().optional().default(""), // Made optional with default
|
|
6
7
|
url: z.string(),
|
|
7
|
-
title: z.string().nullable(),
|
|
8
|
-
description: z.string().nullable(),
|
|
9
|
-
contentType: z.enum(["youtube", "x_twitter", "reddit", "article", "pdf"]),
|
|
10
|
-
status: z.enum(["pending", "processing", "completed", "failed"]),
|
|
11
|
-
summary: z.any().nullable(), // Can be string or object
|
|
12
|
-
keyInsights: z.array(z.string()).nullable(),
|
|
8
|
+
title: z.string().nullable().optional(),
|
|
9
|
+
description: z.string().nullable().optional(),
|
|
10
|
+
contentType: z.enum(["youtube", "x_twitter", "reddit", "article", "pdf"]).optional().default("article"),
|
|
11
|
+
status: z.enum(["pending", "processing", "completed", "failed"]).optional().default("completed"),
|
|
12
|
+
summary: z.any().nullable().optional(), // Can be string or object
|
|
13
|
+
keyInsights: z.array(z.string()).nullable().optional().default(null),
|
|
13
14
|
rawText: z.string().nullable().optional(), // Full content text
|
|
14
15
|
tokenCount: z.number().nullable().optional(), // Estimated token count for raw_text
|
|
15
16
|
ogImage: z.string().nullable().optional(),
|
|
16
17
|
processingMetadata: z.any().nullable().optional(),
|
|
17
|
-
tags: z.array(z.string()).optional(), // Associated tags
|
|
18
|
-
createdAt: z.string(),
|
|
19
|
-
updatedAt: z.string(),
|
|
18
|
+
tags: z.array(z.string()).optional().default([]), // Associated tags with default
|
|
19
|
+
createdAt: z.string().optional().default(() => new Date().toISOString()),
|
|
20
|
+
updatedAt: z.string().optional().default(() => new Date().toISOString()),
|
|
20
21
|
});
|
|
21
22
|
export const ActionSchema = z.object({
|
|
22
23
|
id: z.string(),
|
|
@@ -109,8 +110,27 @@ export class NoverloadClient {
|
|
|
109
110
|
}
|
|
110
111
|
const data = await response.json();
|
|
111
112
|
// v2 returns { success, contents, pagination }
|
|
112
|
-
const
|
|
113
|
-
|
|
113
|
+
const rawContents = data.contents || data;
|
|
114
|
+
// Transform and validate each item with defaults for missing fields
|
|
115
|
+
const transformedContents = Array.isArray(rawContents) ? rawContents.map((item) => ({
|
|
116
|
+
id: item.id || item._id || "",
|
|
117
|
+
userId: item.userId || item.user_id || "",
|
|
118
|
+
url: item.url || "",
|
|
119
|
+
title: item.title || null,
|
|
120
|
+
description: item.description || null,
|
|
121
|
+
contentType: item.contentType || item.content_type || "article",
|
|
122
|
+
status: item.status || "completed",
|
|
123
|
+
summary: item.summary || null,
|
|
124
|
+
keyInsights: item.keyInsights || item.key_insights || null,
|
|
125
|
+
rawText: item.rawText || item.raw_text || null,
|
|
126
|
+
tokenCount: item.tokenCount || item.token_count || null,
|
|
127
|
+
ogImage: item.ogImage || item.og_image || null,
|
|
128
|
+
processingMetadata: item.processingMetadata || item.processing_metadata || null,
|
|
129
|
+
tags: item.tags || [],
|
|
130
|
+
createdAt: item.createdAt || item.created_at || new Date().toISOString(),
|
|
131
|
+
updatedAt: item.updatedAt || item.updated_at || new Date().toISOString(),
|
|
132
|
+
})) : [];
|
|
133
|
+
return z.array(ContentSchema).parse(transformedContents);
|
|
114
134
|
}
|
|
115
135
|
async getContent(id) {
|
|
116
136
|
const response = await this.request(`/api/mcp/v2/content?id=${id}`);
|
|
@@ -136,8 +156,27 @@ export class NoverloadClient {
|
|
|
136
156
|
}
|
|
137
157
|
const data = await response.json();
|
|
138
158
|
// v2 returns { success, content }
|
|
139
|
-
const
|
|
140
|
-
|
|
159
|
+
const rawContent = data.content || data;
|
|
160
|
+
// Transform with defaults for missing fields
|
|
161
|
+
const transformedContent = {
|
|
162
|
+
id: rawContent.id || rawContent._id || "",
|
|
163
|
+
userId: rawContent.userId || rawContent.user_id || "",
|
|
164
|
+
url: rawContent.url || "",
|
|
165
|
+
title: rawContent.title || null,
|
|
166
|
+
description: rawContent.description || null,
|
|
167
|
+
contentType: rawContent.contentType || rawContent.content_type || "article",
|
|
168
|
+
status: rawContent.status || "completed",
|
|
169
|
+
summary: rawContent.summary || null,
|
|
170
|
+
keyInsights: rawContent.keyInsights || rawContent.key_insights || null,
|
|
171
|
+
rawText: rawContent.rawText || rawContent.raw_text || null,
|
|
172
|
+
tokenCount: rawContent.tokenCount || rawContent.token_count || null,
|
|
173
|
+
ogImage: rawContent.ogImage || rawContent.og_image || null,
|
|
174
|
+
processingMetadata: rawContent.processingMetadata || rawContent.processing_metadata || null,
|
|
175
|
+
tags: rawContent.tags || [],
|
|
176
|
+
createdAt: rawContent.createdAt || rawContent.created_at || new Date().toISOString(),
|
|
177
|
+
updatedAt: rawContent.updatedAt || rawContent.updated_at || new Date().toISOString(),
|
|
178
|
+
};
|
|
179
|
+
return ContentSchema.parse(transformedContent);
|
|
141
180
|
}
|
|
142
181
|
async saveContent(url) {
|
|
143
182
|
if (this.config.readOnly) {
|
|
@@ -211,83 +250,162 @@ export class NoverloadClient {
|
|
|
211
250
|
return z.array(GoalSchema).parse(data);
|
|
212
251
|
}
|
|
213
252
|
async searchContent(query, options) {
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const v2Body = {
|
|
235
|
-
query,
|
|
236
|
-
mode: "smart",
|
|
237
|
-
filters: {
|
|
238
|
-
contentTypes: options?.contentTypes,
|
|
239
|
-
dateRange: {
|
|
240
|
-
from: options?.dateFrom,
|
|
241
|
-
to: options?.dateTo,
|
|
253
|
+
// Try v2 search first with better configuration
|
|
254
|
+
try {
|
|
255
|
+
const v2Body = {
|
|
256
|
+
query,
|
|
257
|
+
mode: "smart", // Use smart mode for better results
|
|
258
|
+
filters: options?.contentTypes || options?.tags || options?.dateFrom ? {
|
|
259
|
+
contentTypes: options?.contentTypes,
|
|
260
|
+
dateRange: (options?.dateFrom || options?.dateTo) ? {
|
|
261
|
+
from: options?.dateFrom,
|
|
262
|
+
to: options?.dateTo,
|
|
263
|
+
} : undefined,
|
|
264
|
+
tags: options?.tags,
|
|
265
|
+
domains: options?.excludeDomains ? {
|
|
266
|
+
exclude: options.excludeDomains,
|
|
267
|
+
} : undefined,
|
|
268
|
+
} : undefined,
|
|
269
|
+
options: {
|
|
270
|
+
limit: options?.limit || 10,
|
|
271
|
+
includeContent: options?.includeFullContent || false,
|
|
272
|
+
fuzzy: options?.fuzzyMatch !== false, // Default to true for broader matches
|
|
242
273
|
},
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
274
|
+
features: {
|
|
275
|
+
expandConcepts: options?.enableConceptExpansion !== false, // Default to true
|
|
276
|
+
semanticSearch: true, // Enable semantic search by default
|
|
246
277
|
},
|
|
247
|
-
}
|
|
278
|
+
};
|
|
279
|
+
const response = await this.request(`/api/mcp/v2/search`, {
|
|
280
|
+
method: "POST",
|
|
281
|
+
body: JSON.stringify(v2Body),
|
|
282
|
+
});
|
|
283
|
+
if (!response.ok) {
|
|
284
|
+
// Fall back to v1 search if v2 fails
|
|
285
|
+
console.warn(`v2 search failed with status ${response.status}, trying v1 fallback`);
|
|
286
|
+
return this.searchContentV1(query, options);
|
|
287
|
+
}
|
|
288
|
+
const data = await response.json();
|
|
289
|
+
// v2 returns { success, query, results, pagination, metadata }
|
|
290
|
+
const results = data?.results || [];
|
|
291
|
+
if (Array.isArray(results) && results.length > 0) {
|
|
292
|
+
return results.map((item) => ({
|
|
293
|
+
id: item.id || item._id || "",
|
|
294
|
+
userId: item.userId || item.user_id || "",
|
|
295
|
+
url: item.url || "",
|
|
296
|
+
title: item.title || "Untitled",
|
|
297
|
+
description: item.description || (typeof item.summary === 'string' ? item.summary.slice(0, 500) : ""),
|
|
298
|
+
contentType: item.contentType || item.content_type || "article",
|
|
299
|
+
status: item.status || item.metadata?.processingStatus || "completed",
|
|
300
|
+
summary: item.summary || null,
|
|
301
|
+
keyInsights: item.keyInsights || item.key_insights || [],
|
|
302
|
+
rawText: item.rawText || item.raw_text || item.fullContent || null,
|
|
303
|
+
tokenCount: item.tokenCount || item.token_count || null,
|
|
304
|
+
ogImage: item.ogImage || item.og_image || null,
|
|
305
|
+
processingMetadata: item.processingMetadata || item.processing_metadata || null,
|
|
306
|
+
tags: item.tags || [],
|
|
307
|
+
createdAt: item.createdAt || item.created_at || item.metadata?.createdAt || new Date().toISOString(),
|
|
308
|
+
updatedAt: item.updatedAt || item.updated_at || item.metadata?.updatedAt || new Date().toISOString(),
|
|
309
|
+
relevanceScore: item.relevanceScore || item.score || 0,
|
|
310
|
+
}));
|
|
311
|
+
}
|
|
312
|
+
// If no results, try a fallback search with looser parameters
|
|
313
|
+
if (results.length === 0 && !options?.includeFullContent) {
|
|
314
|
+
console.log("No results found, trying broader search...");
|
|
315
|
+
return this.searchContentV1(query, options);
|
|
316
|
+
}
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
console.error("v2 search error:", error);
|
|
321
|
+
// Fall back to v1 search
|
|
322
|
+
return this.searchContentV1(query, options);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
// Fallback v1 search method for compatibility
|
|
326
|
+
async searchContentV1(query, options) {
|
|
327
|
+
try {
|
|
328
|
+
const params = new URLSearchParams({
|
|
329
|
+
q: query,
|
|
330
|
+
limit: (options?.limit || 10).toString(),
|
|
331
|
+
});
|
|
332
|
+
if (options?.includeFullContent)
|
|
333
|
+
params.append("includeFullContent", "true");
|
|
334
|
+
if (options?.contentTypes)
|
|
335
|
+
params.append("contentTypes", options.contentTypes.join(","));
|
|
336
|
+
if (options?.tags)
|
|
337
|
+
params.append("tags", options.tags.join(","));
|
|
338
|
+
const response = await this.request(`/api/mcp/search?${params}`);
|
|
339
|
+
if (!response.ok) {
|
|
340
|
+
console.error(`v1 search also failed: ${response.status}`);
|
|
341
|
+
return [];
|
|
342
|
+
}
|
|
343
|
+
const data = await response.json();
|
|
344
|
+
const results = Array.isArray(data) ? data : (data.results || []);
|
|
345
|
+
return results.map((item) => ({
|
|
346
|
+
id: item.id || item._id || "",
|
|
347
|
+
userId: item.userId || item.user_id || "",
|
|
348
|
+
url: item.url || "",
|
|
349
|
+
title: item.title || "Untitled",
|
|
350
|
+
description: item.description || "",
|
|
351
|
+
contentType: item.contentType || item.content_type || "article",
|
|
352
|
+
status: item.status || "completed",
|
|
353
|
+
summary: item.summary || null,
|
|
354
|
+
keyInsights: item.keyInsights || item.key_insights || [],
|
|
355
|
+
rawText: item.rawText || item.raw_text || null,
|
|
356
|
+
tokenCount: item.tokenCount || item.token_count || null,
|
|
357
|
+
ogImage: item.ogImage || item.og_image || null,
|
|
358
|
+
processingMetadata: item.processingMetadata || item.processing_metadata || null,
|
|
359
|
+
tags: item.tags || [],
|
|
360
|
+
createdAt: item.createdAt || item.created_at || new Date().toISOString(),
|
|
361
|
+
updatedAt: item.updatedAt || item.updated_at || new Date().toISOString(),
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
console.error("v1 search error:", error);
|
|
366
|
+
return [];
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
// New v2 search method with enhanced features
|
|
370
|
+
async searchContentV2(params) {
|
|
371
|
+
const body = {
|
|
372
|
+
query: params.query,
|
|
373
|
+
mode: params.mode || "smart",
|
|
374
|
+
filters: params.contentTypes ? {
|
|
375
|
+
contentTypes: params.contentTypes,
|
|
376
|
+
} : undefined,
|
|
248
377
|
options: {
|
|
249
|
-
limit:
|
|
250
|
-
includeContent:
|
|
378
|
+
limit: params.limit || 10,
|
|
379
|
+
includeContent: params.includeContent || false,
|
|
380
|
+
fuzzy: true,
|
|
251
381
|
},
|
|
252
382
|
features: {
|
|
253
|
-
expandConcepts:
|
|
383
|
+
expandConcepts: true,
|
|
384
|
+
semanticSearch: true,
|
|
254
385
|
},
|
|
255
386
|
};
|
|
256
387
|
const response = await this.request(`/api/mcp/v2/search`, {
|
|
257
388
|
method: "POST",
|
|
258
|
-
body: JSON.stringify(
|
|
389
|
+
body: JSON.stringify(body),
|
|
259
390
|
});
|
|
260
391
|
if (!response.ok) {
|
|
261
|
-
|
|
262
|
-
console.
|
|
263
|
-
|
|
392
|
+
// Fall back to v1 search if v2 fails
|
|
393
|
+
console.warn(`v2 search failed with status ${response.status}, trying v1 fallback`);
|
|
394
|
+
return this.searchContentV1(params.query, {
|
|
395
|
+
limit: params.limit,
|
|
396
|
+
contentTypes: params.contentTypes,
|
|
397
|
+
includeFullContent: params.includeContent,
|
|
398
|
+
});
|
|
264
399
|
}
|
|
265
400
|
const data = await response.json();
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
userId: item.userId || "",
|
|
272
|
-
url: item.url || "",
|
|
273
|
-
title: item.title,
|
|
274
|
-
description: item.description || (typeof item.summary === 'string' ? item.summary.slice(0, 500) : ""),
|
|
275
|
-
contentType: item.contentType || "article",
|
|
276
|
-
status: item.metadata?.processingStatus || "completed",
|
|
277
|
-
summary: item.summary, // Keep the full summary object
|
|
278
|
-
keyInsights: item.keyInsights || [],
|
|
279
|
-
rawText: item.rawText || item.fullContent || null, // Check both fields
|
|
280
|
-
ogImage: item.ogImage || null,
|
|
281
|
-
processingMetadata: item.processingMetadata || null,
|
|
282
|
-
tags: item.tags || [], // Include tags
|
|
283
|
-
createdAt: item.metadata?.createdAt || item.createdAt || new Date().toISOString(),
|
|
284
|
-
updatedAt: item.metadata?.updatedAt || item.updatedAt || new Date().toISOString(),
|
|
285
|
-
// Include relevance score for better sorting
|
|
286
|
-
relevanceScore: item.relevanceScore,
|
|
401
|
+
// Map results to include aiInsights field
|
|
402
|
+
if (data.results) {
|
|
403
|
+
data.results = data.results.map((item) => ({
|
|
404
|
+
...item,
|
|
405
|
+
aiInsights: item.ai_insights || item.aiInsights || item.processingMetadata?.ai_insights || {},
|
|
287
406
|
}));
|
|
288
407
|
}
|
|
289
|
-
|
|
290
|
-
return [];
|
|
408
|
+
return data;
|
|
291
409
|
}
|
|
292
410
|
// New methods for enhanced endpoints
|
|
293
411
|
async estimateSearchTokens(query, limit = 10) {
|
|
@@ -308,32 +426,104 @@ export class NoverloadClient {
|
|
|
308
426
|
return data.estimate || data;
|
|
309
427
|
}
|
|
310
428
|
async synthesizeContent(params) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
429
|
+
try {
|
|
430
|
+
// If no content IDs provided, search for relevant content first
|
|
431
|
+
let sourceIds = params.contentIds;
|
|
432
|
+
if (!sourceIds || sourceIds.length === 0) {
|
|
433
|
+
// Search for content related to the query
|
|
434
|
+
const searchResults = await this.searchContent(params.query, {
|
|
435
|
+
limit: params.maxSources || 5,
|
|
436
|
+
enableConceptExpansion: true,
|
|
437
|
+
});
|
|
438
|
+
if (searchResults && searchResults.length > 0) {
|
|
439
|
+
sourceIds = searchResults.map((item) => item.id).filter((id) => id);
|
|
440
|
+
}
|
|
441
|
+
if (!sourceIds || sourceIds.length === 0) {
|
|
442
|
+
return {
|
|
443
|
+
success: false,
|
|
444
|
+
error: "No content found to synthesize. Please save some content first or provide specific content IDs.",
|
|
445
|
+
synthesis: null,
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
// Try v2 synthesis endpoint
|
|
450
|
+
const v2Body = {
|
|
451
|
+
sources: {
|
|
452
|
+
contentIds: sourceIds,
|
|
453
|
+
limit: params.maxSources || 5,
|
|
454
|
+
},
|
|
455
|
+
synthesis: {
|
|
456
|
+
mode: params.synthesisMode || "actionable",
|
|
457
|
+
depth: "standard",
|
|
458
|
+
},
|
|
459
|
+
output: {
|
|
460
|
+
includeContradictions: params.findContradictions || false,
|
|
461
|
+
includeConnections: params.findConnections !== false, // Default true
|
|
462
|
+
includeQuotes: true,
|
|
463
|
+
includeActionPlan: params.synthesisMode === "actionable",
|
|
464
|
+
},
|
|
465
|
+
};
|
|
466
|
+
const response = await this.request("/api/mcp/v2/synthesis", {
|
|
467
|
+
method: "POST",
|
|
468
|
+
body: JSON.stringify(v2Body),
|
|
469
|
+
});
|
|
470
|
+
if (!response.ok) {
|
|
471
|
+
// Try fallback v1 synthesis
|
|
472
|
+
console.warn(`v2 synthesis failed with status ${response.status}, trying v1 fallback`);
|
|
473
|
+
return this.synthesizeContentV1(params, sourceIds);
|
|
474
|
+
}
|
|
475
|
+
const data = await response.json();
|
|
476
|
+
return data;
|
|
477
|
+
}
|
|
478
|
+
catch (error) {
|
|
479
|
+
console.error("Synthesis error:", error);
|
|
480
|
+
// Try v1 fallback
|
|
481
|
+
return this.synthesizeContentV1(params, params.contentIds);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
// Fallback v1 synthesis method
|
|
485
|
+
async synthesizeContentV1(params, contentIds) {
|
|
486
|
+
try {
|
|
487
|
+
// If we don't have content IDs, we need to search first
|
|
488
|
+
if (!contentIds || contentIds.length === 0) {
|
|
489
|
+
const searchResults = await this.searchContent(params.query, {
|
|
490
|
+
limit: params.maxSources || 5,
|
|
491
|
+
});
|
|
492
|
+
if (!searchResults || searchResults.length === 0) {
|
|
493
|
+
return {
|
|
494
|
+
success: false,
|
|
495
|
+
error: "No content found to synthesize",
|
|
496
|
+
synthesis: null,
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
contentIds = searchResults.map((item) => item.id).filter((id) => id);
|
|
500
|
+
}
|
|
501
|
+
// Try a simpler synthesis approach
|
|
502
|
+
const response = await this.request("/api/mcp/synthesis", {
|
|
503
|
+
method: "POST",
|
|
504
|
+
body: JSON.stringify({
|
|
505
|
+
query: params.query,
|
|
506
|
+
contentIds: contentIds,
|
|
507
|
+
mode: params.synthesisMode || "actionable",
|
|
508
|
+
}),
|
|
509
|
+
});
|
|
510
|
+
if (!response.ok) {
|
|
511
|
+
const errorText = await response.text().catch(() => "Unknown error");
|
|
512
|
+
return {
|
|
513
|
+
success: false,
|
|
514
|
+
error: `Synthesis failed: ${errorText}`,
|
|
515
|
+
synthesis: null,
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
return response.json();
|
|
519
|
+
}
|
|
520
|
+
catch (error) {
|
|
521
|
+
return {
|
|
522
|
+
success: false,
|
|
523
|
+
error: `Synthesis error: ${error}`,
|
|
524
|
+
synthesis: null,
|
|
525
|
+
};
|
|
335
526
|
}
|
|
336
|
-
return response.json();
|
|
337
527
|
}
|
|
338
528
|
async findSimilarContent(contentId, options) {
|
|
339
529
|
const params = new URLSearchParams();
|
|
@@ -365,5 +555,41 @@ export class NoverloadClient {
|
|
|
365
555
|
}
|
|
366
556
|
return response.json();
|
|
367
557
|
}
|
|
558
|
+
async getEnrichedContent(ids, includeFullContent = false) {
|
|
559
|
+
try {
|
|
560
|
+
const response = await this.request("/api/mcp/v2/content", {
|
|
561
|
+
method: "POST",
|
|
562
|
+
body: JSON.stringify({
|
|
563
|
+
operation: "get",
|
|
564
|
+
contentIds: ids,
|
|
565
|
+
enrich: {
|
|
566
|
+
includeContent: includeFullContent,
|
|
567
|
+
includeActions: false,
|
|
568
|
+
includeConcepts: false,
|
|
569
|
+
includeRelated: false,
|
|
570
|
+
},
|
|
571
|
+
tokenOptions: {
|
|
572
|
+
requireConfirmation: false, // We handle confirmation in the tool
|
|
573
|
+
},
|
|
574
|
+
}),
|
|
575
|
+
});
|
|
576
|
+
if (!response.ok) {
|
|
577
|
+
console.error(`Get enriched content failed: ${response.status}`);
|
|
578
|
+
return [];
|
|
579
|
+
}
|
|
580
|
+
const data = await response.json();
|
|
581
|
+
// Handle confirmation requirement
|
|
582
|
+
if (data.requiresConfirmation) {
|
|
583
|
+
// For now, return empty - the tool will handle the warning
|
|
584
|
+
console.log("Content requires confirmation:", data.message);
|
|
585
|
+
return [];
|
|
586
|
+
}
|
|
587
|
+
return data.contents || [];
|
|
588
|
+
}
|
|
589
|
+
catch (error) {
|
|
590
|
+
console.error("Get enriched content error:", error);
|
|
591
|
+
return [];
|
|
592
|
+
}
|
|
593
|
+
}
|
|
368
594
|
}
|
|
369
595
|
//# sourceMappingURL=client.js.map
|