noverload-mcp 0.6.0 → 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 +8 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +77 -0
- 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 -1079
- 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/tools/index.js
CHANGED
|
@@ -1,1082 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
// Import all tool implementations
|
|
2
|
+
import { listSavedContentTool } from "./implementations/list-content.js";
|
|
3
|
+
import { getContentDetailsTool } from "./implementations/get-content.js";
|
|
4
|
+
import { searchContentTool } from "./implementations/search.js";
|
|
5
|
+
import { saveContentTool } from "./implementations/save-content.js";
|
|
6
|
+
import { listActionsTool, completeActionTool } from "./implementations/actions.js";
|
|
7
|
+
import { listGoalsTool } from "./implementations/goals.js";
|
|
8
|
+
import { estimateSearchTokensTool } from "./implementations/estimate-tokens.js";
|
|
9
|
+
import { synthesizeContentTool } from "./implementations/synthesize.js";
|
|
10
|
+
import { findSimilarContentTool } from "./implementations/similar-content.js";
|
|
11
|
+
import { batchGetContentTool } from "./implementations/batch-get.js";
|
|
12
|
+
import { getInstructionsTool } from "./implementations/instructions.js";
|
|
13
|
+
import { planQueryTool } from "./implementations/plan-query.js";
|
|
14
|
+
import { getRawContentTool } from "./implementations/raw-content.js";
|
|
15
|
+
import { exploreTopicTool } from "./implementations/explore-topic.js";
|
|
16
|
+
import { findConnectionsTool } from "./implementations/find-connections.js";
|
|
17
|
+
import { extractInsightsTool } from "./implementations/extract-insights.js";
|
|
18
|
+
import { getTimelineTool } from "./implementations/timeline.js";
|
|
19
|
+
import { buildKnowledgeGraphTool } from "./implementations/knowledge-graph.js";
|
|
20
|
+
import { extractFrameworksTool } from "./implementations/extract-frameworks.js";
|
|
21
|
+
import { findExamplesTool } from "./implementations/find-examples.js";
|
|
22
|
+
import { buildNarrativeTool } from "./implementations/build-narrative.js";
|
|
23
|
+
import { expandSearchTool } from "./implementations/expand-search.js";
|
|
24
|
+
import { smartSectionsTool } from "./implementations/smart-sections.js";
|
|
25
|
+
// Export all tools as a single array
|
|
2
26
|
export const tools = [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const params = schema.parse(args);
|
|
34
|
-
const content = await client.listContent(params);
|
|
35
|
-
// Build detailed response
|
|
36
|
-
let responseText = `# Saved Content Library\n`;
|
|
37
|
-
responseText += `Found ${content.length} items`;
|
|
38
|
-
const filters = [];
|
|
39
|
-
if (params.status)
|
|
40
|
-
filters.push(`status: ${params.status}`);
|
|
41
|
-
if (params.contentType)
|
|
42
|
-
filters.push(`type: ${params.contentType}`);
|
|
43
|
-
if (filters.length > 0) {
|
|
44
|
-
responseText += ` (filtered by ${filters.join(', ')})`;
|
|
45
|
-
}
|
|
46
|
-
responseText += `\n\n`;
|
|
47
|
-
if (content.length > 0) {
|
|
48
|
-
content.forEach((item, idx) => {
|
|
49
|
-
responseText += `## ${idx + 1}. ${item.title || 'Untitled'}\n`;
|
|
50
|
-
responseText += `**ID:** ${item.id}\n`;
|
|
51
|
-
responseText += `**Type:** ${item.contentType} | **Status:** ${item.status}`;
|
|
52
|
-
if (item.tokenCount) {
|
|
53
|
-
responseText += ` | **Size:** ${item.tokenCount.toLocaleString()} tokens`;
|
|
54
|
-
if (item.tokenCount > 50000) {
|
|
55
|
-
responseText += ` 🚨`;
|
|
56
|
-
}
|
|
57
|
-
else if (item.tokenCount > 10000) {
|
|
58
|
-
responseText += ` ⚠️`;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
responseText += `\n**URL:** ${item.url}\n`;
|
|
62
|
-
if (item.summary) {
|
|
63
|
-
const summaryObj = typeof item.summary === 'string'
|
|
64
|
-
? { text: item.summary }
|
|
65
|
-
: item.summary;
|
|
66
|
-
if (summaryObj.one_sentence) {
|
|
67
|
-
responseText += `**Summary:** ${summaryObj.one_sentence}\n`;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
responseText += `**Saved:** ${new Date(item.createdAt).toLocaleDateString()}\n`;
|
|
71
|
-
responseText += '\n---\n\n';
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
responseText += "No content found matching the specified filters.";
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
content: [
|
|
79
|
-
{
|
|
80
|
-
type: "text",
|
|
81
|
-
text: responseText,
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
data: content,
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "get_content_details",
|
|
90
|
-
description: "Get complete details about a specific saved content item including full transcript/article text, AI-generated summary, key insights, and all metadata",
|
|
91
|
-
inputSchema: {
|
|
92
|
-
type: "object",
|
|
93
|
-
properties: {
|
|
94
|
-
contentId: {
|
|
95
|
-
type: "string",
|
|
96
|
-
description: "The ID of the content to retrieve",
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
required: ["contentId"],
|
|
100
|
-
},
|
|
101
|
-
modifies: false,
|
|
102
|
-
handler: async (client, args) => {
|
|
103
|
-
const schema = z.object({
|
|
104
|
-
contentId: z.string(),
|
|
105
|
-
});
|
|
106
|
-
const { contentId } = schema.parse(args);
|
|
107
|
-
const content = await client.getContent(contentId);
|
|
108
|
-
// Build comprehensive response with all details
|
|
109
|
-
let responseText = `# Content Details: ${content.title || 'Untitled'}\n\n`;
|
|
110
|
-
responseText += `**ID:** ${content.id}\n`;
|
|
111
|
-
responseText += `**Type:** ${content.contentType}\n`;
|
|
112
|
-
responseText += `**Status:** ${content.status}\n`;
|
|
113
|
-
responseText += `**URL:** ${content.url}\n`;
|
|
114
|
-
responseText += `**Saved:** ${new Date(content.createdAt).toLocaleDateString()}\n`;
|
|
115
|
-
// Show content size information
|
|
116
|
-
if (content.tokenCount) {
|
|
117
|
-
responseText += `**Full Content Size:** ${content.tokenCount.toLocaleString()} tokens`;
|
|
118
|
-
if (content.tokenCount > 50000) {
|
|
119
|
-
responseText += ` 🚨 EXTREMELY LARGE`;
|
|
120
|
-
}
|
|
121
|
-
else if (content.tokenCount > 10000) {
|
|
122
|
-
responseText += ` ⚠️ LARGE`;
|
|
123
|
-
}
|
|
124
|
-
responseText += '\n';
|
|
125
|
-
}
|
|
126
|
-
if (content.tags && content.tags.length > 0) {
|
|
127
|
-
responseText += `**Tags:** ${content.tags.join(', ')}\n`;
|
|
128
|
-
}
|
|
129
|
-
responseText += '\n## Summary & Insights\n';
|
|
130
|
-
if (content.summary) {
|
|
131
|
-
const summaryObj = typeof content.summary === 'string'
|
|
132
|
-
? { text: content.summary }
|
|
133
|
-
: content.summary;
|
|
134
|
-
if (summaryObj.one_sentence) {
|
|
135
|
-
responseText += `**One-line Summary:** ${summaryObj.one_sentence}\n\n`;
|
|
136
|
-
}
|
|
137
|
-
if (summaryObj.key_insights && Array.isArray(summaryObj.key_insights)) {
|
|
138
|
-
responseText += `**Key Insights:**\n`;
|
|
139
|
-
summaryObj.key_insights.forEach((insight, idx) => {
|
|
140
|
-
responseText += `${idx + 1}. ${insight}\n`;
|
|
141
|
-
});
|
|
142
|
-
responseText += '\n';
|
|
143
|
-
}
|
|
144
|
-
if (summaryObj.main_topics && Array.isArray(summaryObj.main_topics)) {
|
|
145
|
-
responseText += `**Main Topics:** ${summaryObj.main_topics.join(', ')}\n\n`;
|
|
146
|
-
}
|
|
147
|
-
if (summaryObj.actionable_takeaways && Array.isArray(summaryObj.actionable_takeaways)) {
|
|
148
|
-
responseText += `**Actionable Takeaways:**\n`;
|
|
149
|
-
summaryObj.actionable_takeaways.forEach((takeaway, idx) => {
|
|
150
|
-
responseText += `${idx + 1}. ${takeaway}\n`;
|
|
151
|
-
});
|
|
152
|
-
responseText += '\n';
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
// Include full text content info and preview
|
|
156
|
-
if (content.rawText) {
|
|
157
|
-
const wordCount = content.rawText.split(/\s+/).length;
|
|
158
|
-
responseText += `## Full Content\n`;
|
|
159
|
-
responseText += `**Word Count:** ${wordCount.toLocaleString()} words\n`;
|
|
160
|
-
// Show a reasonable preview (500 chars is about 100 tokens)
|
|
161
|
-
responseText += `**Preview (first 500 chars):**\n`;
|
|
162
|
-
responseText += `${content.rawText.slice(0, 500)}...\n\n`;
|
|
163
|
-
if (content.tokenCount && content.tokenCount > 10000) {
|
|
164
|
-
responseText += `⚠️ **Note:** The complete ${content.contentType} content (${wordCount.toLocaleString()} words, ~${content.tokenCount.toLocaleString()} tokens) is available in the data field.\n`;
|
|
165
|
-
responseText += `This is a large amount of content that will consume significant context if fully processed.\n`;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
responseText += `*Note: Complete content is available in the data field for analysis.*\n`;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
content: [
|
|
173
|
-
{
|
|
174
|
-
type: "text",
|
|
175
|
-
text: responseText,
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
data: content, // Full content including complete rawText
|
|
179
|
-
};
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
name: "search_content",
|
|
184
|
-
description: "Advanced search with OR/ANY logic, fuzzy matching, and smart filters. Supports multiple search modes, content type filtering, date ranges, and relevance explanations.",
|
|
185
|
-
inputSchema: {
|
|
186
|
-
type: "object",
|
|
187
|
-
properties: {
|
|
188
|
-
query: {
|
|
189
|
-
type: "string",
|
|
190
|
-
description: "Search query (supports 'term1 OR term2' for any match, quotes for exact phrases)",
|
|
191
|
-
},
|
|
192
|
-
searchMode: {
|
|
193
|
-
type: "string",
|
|
194
|
-
enum: ["any", "all", "phrase"],
|
|
195
|
-
description: "Search logic: 'any' (OR logic), 'all' (AND logic), 'phrase' (exact phrase)",
|
|
196
|
-
default: "any",
|
|
197
|
-
},
|
|
198
|
-
fuzzyMatch: {
|
|
199
|
-
type: "boolean",
|
|
200
|
-
description: "Enable fuzzy/typo-tolerant matching",
|
|
201
|
-
default: true,
|
|
202
|
-
},
|
|
203
|
-
tags: {
|
|
204
|
-
type: "array",
|
|
205
|
-
items: {
|
|
206
|
-
type: "string",
|
|
207
|
-
},
|
|
208
|
-
description: "Filter by tags",
|
|
209
|
-
},
|
|
210
|
-
limit: {
|
|
211
|
-
type: "number",
|
|
212
|
-
description: "Maximum results (default: 10)",
|
|
213
|
-
default: 10,
|
|
214
|
-
},
|
|
215
|
-
includeFullContent: {
|
|
216
|
-
type: "boolean",
|
|
217
|
-
description: "Include full text (WARNING: 10k-100k+ tokens)",
|
|
218
|
-
default: false,
|
|
219
|
-
},
|
|
220
|
-
contentTypes: {
|
|
221
|
-
type: "array",
|
|
222
|
-
items: {
|
|
223
|
-
type: "string",
|
|
224
|
-
enum: ["youtube", "x_twitter", "reddit", "article", "pdf"],
|
|
225
|
-
},
|
|
226
|
-
description: "Filter by content types",
|
|
227
|
-
},
|
|
228
|
-
dateFrom: {
|
|
229
|
-
type: "string",
|
|
230
|
-
description: "Content saved after this date (ISO 8601)",
|
|
231
|
-
},
|
|
232
|
-
dateTo: {
|
|
233
|
-
type: "string",
|
|
234
|
-
description: "Content saved before this date (ISO 8601)",
|
|
235
|
-
},
|
|
236
|
-
excludeDomains: {
|
|
237
|
-
type: "array",
|
|
238
|
-
items: {
|
|
239
|
-
type: "string",
|
|
240
|
-
},
|
|
241
|
-
description: "Domains to exclude",
|
|
242
|
-
},
|
|
243
|
-
showRelevanceExplanation: {
|
|
244
|
-
type: "boolean",
|
|
245
|
-
description: "Show why each result matched",
|
|
246
|
-
default: true,
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
required: ["query"],
|
|
250
|
-
},
|
|
251
|
-
modifies: false,
|
|
252
|
-
handler: async (client, args) => {
|
|
253
|
-
const schema = z.object({
|
|
254
|
-
query: z.string(),
|
|
255
|
-
searchMode: z.enum(["any", "all", "phrase"]).optional().default("any"),
|
|
256
|
-
fuzzyMatch: z.boolean().optional().default(true),
|
|
257
|
-
tags: z.array(z.string()).optional(),
|
|
258
|
-
limit: z.number().optional().default(10),
|
|
259
|
-
includeFullContent: z.boolean().optional().default(false),
|
|
260
|
-
contentTypes: z.array(z.enum(["youtube", "x_twitter", "reddit", "article", "pdf"])).optional(),
|
|
261
|
-
dateFrom: z.string().optional(),
|
|
262
|
-
dateTo: z.string().optional(),
|
|
263
|
-
excludeDomains: z.array(z.string()).optional(),
|
|
264
|
-
showRelevanceExplanation: z.boolean().optional().default(true),
|
|
265
|
-
});
|
|
266
|
-
const params = schema.parse(args);
|
|
267
|
-
// Enhance search query based on mode
|
|
268
|
-
let enhancedQuery = params.query;
|
|
269
|
-
if (params.searchMode === "any" && !params.query.includes("OR")) {
|
|
270
|
-
// Convert space-separated terms to OR query for broader matching
|
|
271
|
-
const terms = params.query.split(/\s+/).filter(t => t.length > 2);
|
|
272
|
-
if (terms.length > 1) {
|
|
273
|
-
enhancedQuery = terms.join(" OR ");
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
const results = await client.searchContent(enhancedQuery, {
|
|
277
|
-
...params,
|
|
278
|
-
enableConceptExpansion: params.fuzzyMatch, // Use fuzzy matching as concept expansion
|
|
279
|
-
});
|
|
280
|
-
// Format response with visual indicators
|
|
281
|
-
let responseText = `# 🔍 Search Results: "${params.query}"\n`;
|
|
282
|
-
responseText += `**Mode:** ${params.searchMode.toUpperCase()}${params.fuzzyMatch ? " with fuzzy matching" : ""}\n`;
|
|
283
|
-
responseText += `**Found:** ${results.length} results`;
|
|
284
|
-
// Show active filters
|
|
285
|
-
const filters = [];
|
|
286
|
-
if (params.tags?.length)
|
|
287
|
-
filters.push(`📌 tags: ${params.tags.join(", ")}`);
|
|
288
|
-
if (params.contentTypes?.length)
|
|
289
|
-
filters.push(`📁 types: ${params.contentTypes.join(", ")}`);
|
|
290
|
-
if (params.dateFrom || params.dateTo)
|
|
291
|
-
filters.push(`📅 date range`);
|
|
292
|
-
if (params.excludeDomains?.length)
|
|
293
|
-
filters.push(`🚫 excluded: ${params.excludeDomains.join(", ")}`);
|
|
294
|
-
if (filters.length > 0) {
|
|
295
|
-
responseText += `\n**Filters:** ${filters.join(" | ")}`;
|
|
296
|
-
}
|
|
297
|
-
if (params.includeFullContent) {
|
|
298
|
-
responseText += `\n⚠️ **Full content included** - consuming significant tokens`;
|
|
299
|
-
}
|
|
300
|
-
responseText += `\n\n`;
|
|
301
|
-
if (results.length > 0) {
|
|
302
|
-
// Add search suggestions if no perfect matches
|
|
303
|
-
if (results.length < 3) {
|
|
304
|
-
responseText += `💡 **Tip:** Try broader search with 'any' mode or disable filters for more results\n\n`;
|
|
305
|
-
}
|
|
306
|
-
results.forEach((result, idx) => {
|
|
307
|
-
// Visual indicators for content type
|
|
308
|
-
const typeIcons = {
|
|
309
|
-
youtube: "📺",
|
|
310
|
-
x_twitter: "𝕏",
|
|
311
|
-
reddit: "🔗",
|
|
312
|
-
article: "📄",
|
|
313
|
-
pdf: "📑"
|
|
314
|
-
};
|
|
315
|
-
const typeIcon = typeIcons[result.contentType] || "📄";
|
|
316
|
-
// Relevance indicator
|
|
317
|
-
let relevanceIcon = "";
|
|
318
|
-
if (result.relevanceScore) {
|
|
319
|
-
if (result.relevanceScore > 0.8)
|
|
320
|
-
relevanceIcon = "🎯";
|
|
321
|
-
else if (result.relevanceScore > 0.6)
|
|
322
|
-
relevanceIcon = "✅";
|
|
323
|
-
else if (result.relevanceScore > 0.4)
|
|
324
|
-
relevanceIcon = "➡️";
|
|
325
|
-
}
|
|
326
|
-
responseText += `## ${idx + 1}. ${typeIcon} ${result.title || 'Untitled'} ${relevanceIcon}\n`;
|
|
327
|
-
responseText += `**ID:** \`${result.id}\`\n`;
|
|
328
|
-
responseText += `**URL:** ${result.url}\n`;
|
|
329
|
-
// Show relevance explanation if available
|
|
330
|
-
if (params.showRelevanceExplanation) {
|
|
331
|
-
if (result.matchReason && Array.isArray(result.matchReason)) {
|
|
332
|
-
responseText += `**Why matched:** Matched in ${result.matchReason.join(", ")}\n`;
|
|
333
|
-
}
|
|
334
|
-
else if (result.relevanceScore) {
|
|
335
|
-
const percentage = (result.relevanceScore * 100).toFixed(0);
|
|
336
|
-
responseText += `**Relevance:** ${percentage}% match\n`;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
// Content size indicator with better formatting
|
|
340
|
-
if (result.tokenCount) {
|
|
341
|
-
const sizeIcon = result.tokenCount > 50000 ? "🚨" :
|
|
342
|
-
result.tokenCount > 10000 ? "⚠️" :
|
|
343
|
-
result.tokenCount > 5000 ? "📊" : "📝";
|
|
344
|
-
responseText += `**Size:** ${sizeIcon} ~${result.tokenCount.toLocaleString()} tokens`;
|
|
345
|
-
if (params.includeFullContent) {
|
|
346
|
-
responseText += ` (full content included)`;
|
|
347
|
-
}
|
|
348
|
-
responseText += `\n`;
|
|
349
|
-
}
|
|
350
|
-
// Tags with better formatting
|
|
351
|
-
if (result.tags && result.tags.length > 0) {
|
|
352
|
-
responseText += `**Tags:** ${result.tags.map((t) => `\`${t}\``).join(' ')}\n`;
|
|
353
|
-
}
|
|
354
|
-
// Summary section with structure
|
|
355
|
-
if (result.summary) {
|
|
356
|
-
const summaryObj = typeof result.summary === 'string'
|
|
357
|
-
? { text: result.summary }
|
|
358
|
-
: result.summary;
|
|
359
|
-
if (summaryObj.one_sentence) {
|
|
360
|
-
responseText += `\n📝 **Summary:** ${summaryObj.one_sentence}\n`;
|
|
361
|
-
}
|
|
362
|
-
// Key insights with bullets
|
|
363
|
-
if (summaryObj.key_insights && Array.isArray(summaryObj.key_insights) && summaryObj.key_insights.length > 0) {
|
|
364
|
-
responseText += `\n💡 **Key Insights:**\n`;
|
|
365
|
-
summaryObj.key_insights.slice(0, 3).forEach((insight) => {
|
|
366
|
-
responseText += ` • ${insight}\n`;
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
// Actionable takeaways
|
|
370
|
-
if (summaryObj.actionable_takeaways && Array.isArray(summaryObj.actionable_takeaways) && summaryObj.actionable_takeaways.length > 0) {
|
|
371
|
-
responseText += `\n🎯 **Actions:**\n`;
|
|
372
|
-
summaryObj.actionable_takeaways.slice(0, 2).forEach((action) => {
|
|
373
|
-
responseText += ` → ${action}\n`;
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
responseText += '\n---\n\n';
|
|
378
|
-
});
|
|
379
|
-
// Smart token usage summary
|
|
380
|
-
if (!params.includeFullContent) {
|
|
381
|
-
let totalAvailable = 0;
|
|
382
|
-
results.forEach((r) => {
|
|
383
|
-
if (r.tokenCount)
|
|
384
|
-
totalAvailable += r.tokenCount;
|
|
385
|
-
});
|
|
386
|
-
if (totalAvailable > 0) {
|
|
387
|
-
responseText += `\n📊 **Content Overview:**\n`;
|
|
388
|
-
responseText += `- Showing: Summaries and metadata (minimal tokens)\n`;
|
|
389
|
-
responseText += `- Available: ~${totalAvailable.toLocaleString()} tokens of full content\n`;
|
|
390
|
-
responseText += `- To access: Use \`get_content_details\` for specific items\n`;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
// Search quality feedback
|
|
394
|
-
if (results.length === params.limit) {
|
|
395
|
-
responseText += `\n💡 **Note:** Showing top ${params.limit} results. More may be available.\n`;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
// No results - provide helpful suggestions
|
|
400
|
-
responseText += "## No Results Found 😔\n\n";
|
|
401
|
-
responseText += "**Try these approaches:**\n";
|
|
402
|
-
responseText += "1. 🔄 Switch to `searchMode: 'any'` for broader matching\n";
|
|
403
|
-
responseText += "2. ✏️ Check spelling or use simpler terms\n";
|
|
404
|
-
responseText += "3. 🎯 Remove filters (dates, types, domains)\n";
|
|
405
|
-
responseText += "4. 🔍 Use more general keywords\n";
|
|
406
|
-
// Suggest alternative queries
|
|
407
|
-
const terms = params.query.split(/\s+/);
|
|
408
|
-
if (terms.length > 1) {
|
|
409
|
-
responseText += `\n**Alternative queries:**\n`;
|
|
410
|
-
responseText += `- "${terms[0]}" (single term)\n`;
|
|
411
|
-
responseText += `- "${terms.slice(0, 2).join(' ')}" (first two terms)\n`;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
return {
|
|
415
|
-
content: [
|
|
416
|
-
{
|
|
417
|
-
type: "text",
|
|
418
|
-
text: responseText,
|
|
419
|
-
},
|
|
420
|
-
],
|
|
421
|
-
data: results,
|
|
422
|
-
};
|
|
423
|
-
},
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
name: "save_content",
|
|
427
|
-
description: "Save a new URL to Noverload for processing",
|
|
428
|
-
inputSchema: {
|
|
429
|
-
type: "object",
|
|
430
|
-
properties: {
|
|
431
|
-
url: {
|
|
432
|
-
type: "string",
|
|
433
|
-
description: "URL to save (YouTube, X/Twitter, Reddit, article, or PDF)",
|
|
434
|
-
},
|
|
435
|
-
},
|
|
436
|
-
required: ["url"],
|
|
437
|
-
},
|
|
438
|
-
modifies: true,
|
|
439
|
-
handler: async (client, args) => {
|
|
440
|
-
const schema = z.object({
|
|
441
|
-
url: z.string().url(),
|
|
442
|
-
});
|
|
443
|
-
const { url } = schema.parse(args);
|
|
444
|
-
const content = await client.saveContent(url);
|
|
445
|
-
return {
|
|
446
|
-
content: [
|
|
447
|
-
{
|
|
448
|
-
type: "text",
|
|
449
|
-
text: content.title ? `Saved: ${content.title}` : `Saved content from: ${new URL(url).hostname}`,
|
|
450
|
-
},
|
|
451
|
-
],
|
|
452
|
-
data: content,
|
|
453
|
-
};
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
name: "list_actions",
|
|
458
|
-
description: "List action items extracted from saved content",
|
|
459
|
-
inputSchema: {
|
|
460
|
-
type: "object",
|
|
461
|
-
properties: {
|
|
462
|
-
contentId: {
|
|
463
|
-
type: "string",
|
|
464
|
-
description: "Filter by content ID",
|
|
465
|
-
},
|
|
466
|
-
goalId: {
|
|
467
|
-
type: "string",
|
|
468
|
-
description: "Filter by goal ID",
|
|
469
|
-
},
|
|
470
|
-
completed: {
|
|
471
|
-
type: "boolean",
|
|
472
|
-
description: "Filter by completion status",
|
|
473
|
-
},
|
|
474
|
-
},
|
|
475
|
-
},
|
|
476
|
-
modifies: false,
|
|
477
|
-
handler: async (client, args) => {
|
|
478
|
-
const schema = z.object({
|
|
479
|
-
contentId: z.string().optional(),
|
|
480
|
-
goalId: z.string().optional(),
|
|
481
|
-
completed: z.boolean().optional(),
|
|
482
|
-
});
|
|
483
|
-
const params = schema.parse(args);
|
|
484
|
-
const actions = await client.listActions(params);
|
|
485
|
-
return {
|
|
486
|
-
content: [
|
|
487
|
-
{
|
|
488
|
-
type: "text",
|
|
489
|
-
text: `Found ${actions.length} actions`,
|
|
490
|
-
},
|
|
491
|
-
],
|
|
492
|
-
data: actions,
|
|
493
|
-
};
|
|
494
|
-
},
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
name: "complete_action",
|
|
498
|
-
description: "Mark an action item as completed",
|
|
499
|
-
inputSchema: {
|
|
500
|
-
type: "object",
|
|
501
|
-
properties: {
|
|
502
|
-
actionId: {
|
|
503
|
-
type: "string",
|
|
504
|
-
description: "The ID of the action to complete",
|
|
505
|
-
},
|
|
506
|
-
},
|
|
507
|
-
required: ["actionId"],
|
|
508
|
-
},
|
|
509
|
-
modifies: true,
|
|
510
|
-
handler: async (client, args) => {
|
|
511
|
-
const schema = z.object({
|
|
512
|
-
actionId: z.string(),
|
|
513
|
-
});
|
|
514
|
-
const { actionId } = schema.parse(args);
|
|
515
|
-
const action = await client.completeAction(actionId);
|
|
516
|
-
return {
|
|
517
|
-
content: [
|
|
518
|
-
{
|
|
519
|
-
type: "text",
|
|
520
|
-
text: `Completed action: ${action.title}`,
|
|
521
|
-
},
|
|
522
|
-
],
|
|
523
|
-
data: action,
|
|
524
|
-
};
|
|
525
|
-
},
|
|
526
|
-
},
|
|
527
|
-
{
|
|
528
|
-
name: "list_goals",
|
|
529
|
-
description: "List user's goals (Health, Wealth, Relationships)",
|
|
530
|
-
inputSchema: {
|
|
531
|
-
type: "object",
|
|
532
|
-
properties: {},
|
|
533
|
-
},
|
|
534
|
-
modifies: false,
|
|
535
|
-
handler: async (client) => {
|
|
536
|
-
const goals = await client.listGoals();
|
|
537
|
-
return {
|
|
538
|
-
content: [
|
|
539
|
-
{
|
|
540
|
-
type: "text",
|
|
541
|
-
text: `Found ${goals.length} goals`,
|
|
542
|
-
},
|
|
543
|
-
],
|
|
544
|
-
data: goals,
|
|
545
|
-
};
|
|
546
|
-
},
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
name: "estimate_search_tokens",
|
|
550
|
-
description: "Estimate token usage before performing a search. Helps manage context window and API costs.",
|
|
551
|
-
inputSchema: {
|
|
552
|
-
type: "object",
|
|
553
|
-
properties: {
|
|
554
|
-
query: {
|
|
555
|
-
type: "string",
|
|
556
|
-
description: "Search query to estimate",
|
|
557
|
-
},
|
|
558
|
-
limit: {
|
|
559
|
-
type: "number",
|
|
560
|
-
description: "Number of results to estimate for",
|
|
561
|
-
default: 10,
|
|
562
|
-
},
|
|
563
|
-
},
|
|
564
|
-
required: ["query"],
|
|
565
|
-
},
|
|
566
|
-
modifies: false,
|
|
567
|
-
handler: async (client, args) => {
|
|
568
|
-
const schema = z.object({
|
|
569
|
-
query: z.string(),
|
|
570
|
-
limit: z.number().optional().default(10),
|
|
571
|
-
});
|
|
572
|
-
const params = schema.parse(args);
|
|
573
|
-
const estimate = await client.estimateSearchTokens(params.query, params.limit);
|
|
574
|
-
let responseText = `# Token Estimate for: "${params.query}"\n\n`;
|
|
575
|
-
responseText += `**Total Estimated Tokens:** ${estimate.totals?.estimatedTokens || 0}\n`;
|
|
576
|
-
responseText += `**Recommendation:** ${estimate.recommendation || "Unknown"}\n\n`;
|
|
577
|
-
if (estimate.costEstimate) {
|
|
578
|
-
responseText += `## Estimated Costs\n`;
|
|
579
|
-
responseText += `- GPT-4: ${estimate.costEstimate.gpt4}\n`;
|
|
580
|
-
responseText += `- GPT-3.5: ${estimate.costEstimate.gpt35}\n`;
|
|
581
|
-
responseText += `- Claude 3: ${estimate.costEstimate.claude3}\n\n`;
|
|
582
|
-
}
|
|
583
|
-
if (estimate.estimates && estimate.estimates.length > 0) {
|
|
584
|
-
responseText += `## Content Breakdown\n`;
|
|
585
|
-
estimate.estimates.forEach((item, idx) => {
|
|
586
|
-
responseText += `${idx + 1}. ${item.title || "Untitled"} - ${item.estimatedTokens} tokens\n`;
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
return {
|
|
590
|
-
content: [
|
|
591
|
-
{
|
|
592
|
-
type: "text",
|
|
593
|
-
text: responseText,
|
|
594
|
-
},
|
|
595
|
-
],
|
|
596
|
-
data: estimate,
|
|
597
|
-
};
|
|
598
|
-
},
|
|
599
|
-
},
|
|
600
|
-
{
|
|
601
|
-
name: "synthesize_content",
|
|
602
|
-
description: "Analyze multiple content sources to generate actionable insights, find patterns, connections, and contradictions. Creates structured synthesis with timeline, next steps, and confidence scores.",
|
|
603
|
-
inputSchema: {
|
|
604
|
-
type: "object",
|
|
605
|
-
properties: {
|
|
606
|
-
query: {
|
|
607
|
-
type: "string",
|
|
608
|
-
description: "Topic or question to synthesize insights about",
|
|
609
|
-
},
|
|
610
|
-
contentIds: {
|
|
611
|
-
type: "array",
|
|
612
|
-
items: {
|
|
613
|
-
type: "string",
|
|
614
|
-
},
|
|
615
|
-
description: "Specific content IDs to analyze (optional, otherwise uses search)",
|
|
616
|
-
},
|
|
617
|
-
synthesisMode: {
|
|
618
|
-
type: "string",
|
|
619
|
-
enum: ["overview", "deep", "actionable", "comparison"],
|
|
620
|
-
description: "Type of synthesis to perform (default: actionable)",
|
|
621
|
-
default: "actionable",
|
|
622
|
-
},
|
|
623
|
-
findContradictions: {
|
|
624
|
-
type: "boolean",
|
|
625
|
-
description: "Look for contradictions between sources",
|
|
626
|
-
default: false,
|
|
627
|
-
},
|
|
628
|
-
findConnections: {
|
|
629
|
-
type: "boolean",
|
|
630
|
-
description: "Find connections and patterns across sources",
|
|
631
|
-
default: true,
|
|
632
|
-
},
|
|
633
|
-
maxSources: {
|
|
634
|
-
type: "number",
|
|
635
|
-
description: "Maximum number of sources to analyze",
|
|
636
|
-
default: 10,
|
|
637
|
-
},
|
|
638
|
-
},
|
|
639
|
-
required: ["query"],
|
|
640
|
-
},
|
|
641
|
-
modifies: false,
|
|
642
|
-
handler: async (client, args) => {
|
|
643
|
-
const schema = z.object({
|
|
644
|
-
query: z.string(),
|
|
645
|
-
contentIds: z.array(z.string()).optional(),
|
|
646
|
-
synthesisMode: z.enum(["overview", "deep", "actionable", "comparison"]).optional().default("actionable"),
|
|
647
|
-
findContradictions: z.boolean().optional().default(false),
|
|
648
|
-
findConnections: z.boolean().optional().default(true),
|
|
649
|
-
maxSources: z.number().optional().default(10),
|
|
650
|
-
});
|
|
651
|
-
const params = schema.parse(args);
|
|
652
|
-
const result = await client.synthesizeContent(params);
|
|
653
|
-
// Handle the API v2 response format
|
|
654
|
-
const synthesis = result.synthesis || result;
|
|
655
|
-
const metadata = result.metadata || {};
|
|
656
|
-
const sources = result.sources || [];
|
|
657
|
-
let responseText = `# 🎯 Synthesis: "${params.query}"\n`;
|
|
658
|
-
responseText += `**Mode:** ${synthesis.mode || params.synthesisMode} | **Sources:** ${metadata.sourceCount || sources.length}`;
|
|
659
|
-
// Add confidence indicator if available
|
|
660
|
-
if (metadata.confidence) {
|
|
661
|
-
const confidenceIcon = metadata.confidence >= 80 ? "🟢" : metadata.confidence >= 60 ? "🟡" : "🔴";
|
|
662
|
-
responseText += ` | **Confidence:** ${confidenceIcon} ${metadata.confidence}%`;
|
|
663
|
-
}
|
|
664
|
-
responseText += `\n\n`;
|
|
665
|
-
// Summary Section
|
|
666
|
-
if (synthesis.summary) {
|
|
667
|
-
responseText += `## 📋 Summary\n${synthesis.summary}\n\n`;
|
|
668
|
-
}
|
|
669
|
-
// Insights Section (most important)
|
|
670
|
-
if (synthesis.insights && synthesis.insights.length > 0) {
|
|
671
|
-
responseText += `## 💡 Key Insights\n`;
|
|
672
|
-
synthesis.insights.forEach((insight, idx) => {
|
|
673
|
-
// Handle both string and object insights
|
|
674
|
-
if (typeof insight === 'string') {
|
|
675
|
-
responseText += `${idx + 1}. ${insight}\n`;
|
|
676
|
-
}
|
|
677
|
-
else if (insight.text) {
|
|
678
|
-
responseText += `${idx + 1}. **${insight.text}**`;
|
|
679
|
-
if (insight.sourceTitle) {
|
|
680
|
-
responseText += ` *(from: ${insight.sourceTitle})*`;
|
|
681
|
-
}
|
|
682
|
-
responseText += `\n`;
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
responseText += `\n`;
|
|
686
|
-
}
|
|
687
|
-
// Themes Section
|
|
688
|
-
if (synthesis.themes && synthesis.themes.length > 0) {
|
|
689
|
-
responseText += `## 🎨 Major Themes\n`;
|
|
690
|
-
synthesis.themes.forEach((theme) => {
|
|
691
|
-
if (typeof theme === 'string') {
|
|
692
|
-
responseText += `- ${theme}\n`;
|
|
693
|
-
}
|
|
694
|
-
else if (theme.theme) {
|
|
695
|
-
responseText += `\n### ${theme.theme}`;
|
|
696
|
-
if (theme.prevalence) {
|
|
697
|
-
responseText += ` (strength: ${theme.prevalence})`;
|
|
698
|
-
}
|
|
699
|
-
responseText += `\n`;
|
|
700
|
-
if (theme.concepts && theme.concepts.length > 0) {
|
|
701
|
-
responseText += `Related concepts: `;
|
|
702
|
-
responseText += theme.concepts.slice(0, 3).map((c) => typeof c === 'string' ? c : c.concept).join(', ');
|
|
703
|
-
responseText += `\n`;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
});
|
|
707
|
-
responseText += `\n`;
|
|
708
|
-
}
|
|
709
|
-
// Priorities (for actionable mode)
|
|
710
|
-
if (synthesis.priorities) {
|
|
711
|
-
responseText += `## 🎯 Priorities\n`;
|
|
712
|
-
if (synthesis.priorities.high && synthesis.priorities.high.length > 0) {
|
|
713
|
-
responseText += `\n### 🔴 High Priority\n`;
|
|
714
|
-
synthesis.priorities.high.forEach((item) => {
|
|
715
|
-
responseText += `- ${item}\n`;
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
if (synthesis.priorities.medium && synthesis.priorities.medium.length > 0) {
|
|
719
|
-
responseText += `\n### 🟡 Medium Priority\n`;
|
|
720
|
-
synthesis.priorities.medium.forEach((item) => {
|
|
721
|
-
responseText += `- ${item}\n`;
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
if (synthesis.priorities.low && synthesis.priorities.low.length > 0) {
|
|
725
|
-
responseText += `\n### 🟢 Low Priority\n`;
|
|
726
|
-
synthesis.priorities.low.forEach((item) => {
|
|
727
|
-
responseText += `- ${item}\n`;
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
responseText += `\n`;
|
|
731
|
-
}
|
|
732
|
-
// Implementation Steps (for actionable mode)
|
|
733
|
-
if (synthesis.implementation && synthesis.implementation.length > 0) {
|
|
734
|
-
responseText += `## 📝 Implementation Steps\n`;
|
|
735
|
-
synthesis.implementation.forEach((step, idx) => {
|
|
736
|
-
responseText += `${idx + 1}. ${step}\n`;
|
|
737
|
-
});
|
|
738
|
-
responseText += `\n`;
|
|
739
|
-
}
|
|
740
|
-
// Source Comparison (for comparative mode)
|
|
741
|
-
if (synthesis.sourceComparison && synthesis.sourceComparison.length > 0) {
|
|
742
|
-
responseText += `## 📊 Source Comparison\n`;
|
|
743
|
-
synthesis.sourceComparison.forEach((source) => {
|
|
744
|
-
responseText += `\n### ${source.source}\n`;
|
|
745
|
-
responseText += `- **Insights:** ${source.insightCount}\n`;
|
|
746
|
-
if (source.mainThemes && source.mainThemes.length > 0) {
|
|
747
|
-
responseText += `- **Main themes:** ${source.mainThemes.join(', ')}\n`;
|
|
748
|
-
}
|
|
749
|
-
});
|
|
750
|
-
responseText += `\n`;
|
|
751
|
-
}
|
|
752
|
-
// Commonalities and Differences
|
|
753
|
-
if (synthesis.commonalities && synthesis.commonalities.length > 0) {
|
|
754
|
-
responseText += `## ✅ Common Themes Across Sources\n`;
|
|
755
|
-
synthesis.commonalities.forEach((theme) => {
|
|
756
|
-
responseText += `- ${theme}\n`;
|
|
757
|
-
});
|
|
758
|
-
responseText += `\n`;
|
|
759
|
-
}
|
|
760
|
-
if (synthesis.differences && synthesis.differences.length > 0) {
|
|
761
|
-
responseText += `## 🔀 Unique Perspectives\n`;
|
|
762
|
-
synthesis.differences.forEach((diff) => {
|
|
763
|
-
responseText += `- **${diff.source}:** ${diff.themes.join(', ')}\n`;
|
|
764
|
-
});
|
|
765
|
-
responseText += `\n`;
|
|
766
|
-
}
|
|
767
|
-
// Connections
|
|
768
|
-
if (synthesis.connections && synthesis.connections.length > 0) {
|
|
769
|
-
responseText += `## 🔗 Connections & Patterns\n`;
|
|
770
|
-
synthesis.connections.forEach((conn) => {
|
|
771
|
-
if (conn.concept && conn.sources) {
|
|
772
|
-
responseText += `- **${conn.concept}** appears in: ${conn.sources.join(', ')}`;
|
|
773
|
-
if (conn.strength) {
|
|
774
|
-
responseText += ` (strength: ${conn.strength})`;
|
|
775
|
-
}
|
|
776
|
-
responseText += `\n`;
|
|
777
|
-
}
|
|
778
|
-
else if (conn.pattern) {
|
|
779
|
-
responseText += `- **${conn.pattern}**`;
|
|
780
|
-
if (conn.implication) {
|
|
781
|
-
responseText += `: ${conn.implication}`;
|
|
782
|
-
}
|
|
783
|
-
responseText += `\n`;
|
|
784
|
-
}
|
|
785
|
-
});
|
|
786
|
-
responseText += `\n`;
|
|
787
|
-
}
|
|
788
|
-
// Contradictions
|
|
789
|
-
if (synthesis.contradictions && synthesis.contradictions.length > 0) {
|
|
790
|
-
responseText += `## ⚡ Contradictions Found\n`;
|
|
791
|
-
synthesis.contradictions.forEach((contra) => {
|
|
792
|
-
if (contra.source1 && contra.statement1) {
|
|
793
|
-
responseText += `\n### Potential Contradiction\n`;
|
|
794
|
-
responseText += `- **${contra.source1}:** "${contra.statement1}"\n`;
|
|
795
|
-
responseText += `- **${contra.source2}:** "${contra.statement2}"\n`;
|
|
796
|
-
if (contra.type) {
|
|
797
|
-
responseText += `- **Type:** ${contra.type}\n`;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
else if (contra.topic) {
|
|
801
|
-
responseText += `\n### ${contra.topic}\n`;
|
|
802
|
-
if (contra.viewpoints) {
|
|
803
|
-
contra.viewpoints.forEach((vp) => {
|
|
804
|
-
responseText += `- **${vp.position}:** ${vp.argument}\n`;
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
if (contra.resolution) {
|
|
808
|
-
responseText += `**Suggested resolution:** ${contra.resolution}\n`;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
});
|
|
812
|
-
responseText += `\n`;
|
|
813
|
-
}
|
|
814
|
-
// Timeline
|
|
815
|
-
if (synthesis.timeline && synthesis.timeline.length > 0) {
|
|
816
|
-
responseText += `## ⏱️ Timeline\n`;
|
|
817
|
-
synthesis.timeline.forEach((event) => {
|
|
818
|
-
if (event.date) {
|
|
819
|
-
responseText += `- **${event.date}:** ${event.event}`;
|
|
820
|
-
if (event.source) {
|
|
821
|
-
responseText += ` *(${event.source})*`;
|
|
822
|
-
}
|
|
823
|
-
responseText += `\n`;
|
|
824
|
-
}
|
|
825
|
-
else if (event.phase) {
|
|
826
|
-
responseText += `\n### ${event.phase}`;
|
|
827
|
-
if (event.duration) {
|
|
828
|
-
responseText += ` (${event.duration})`;
|
|
829
|
-
}
|
|
830
|
-
responseText += `\n`;
|
|
831
|
-
if (event.activities && event.activities.length > 0) {
|
|
832
|
-
event.activities.forEach((activity) => {
|
|
833
|
-
responseText += `- ${activity}\n`;
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
});
|
|
838
|
-
responseText += `\n`;
|
|
839
|
-
}
|
|
840
|
-
// Action Plan
|
|
841
|
-
if (synthesis.actionPlan) {
|
|
842
|
-
responseText += `## 🚀 Action Plan\n`;
|
|
843
|
-
if (synthesis.actionPlan.summary) {
|
|
844
|
-
responseText += `${synthesis.actionPlan.summary}\n\n`;
|
|
845
|
-
}
|
|
846
|
-
if (synthesis.actionPlan.nextAction) {
|
|
847
|
-
responseText += `**🎯 Next Action:** ${synthesis.actionPlan.nextAction.action || synthesis.actionPlan.nextAction}\n\n`;
|
|
848
|
-
}
|
|
849
|
-
if (synthesis.actionPlan.steps && synthesis.actionPlan.steps.length > 0) {
|
|
850
|
-
responseText += `### Steps\n`;
|
|
851
|
-
synthesis.actionPlan.steps.forEach((step, idx) => {
|
|
852
|
-
const priorityIcon = step.priority === "high" ? "🔴" : step.priority === "medium" ? "🟡" : "🟢";
|
|
853
|
-
responseText += `${idx + 1}. ${priorityIcon} **${step.action}**`;
|
|
854
|
-
if (step.timeframe) {
|
|
855
|
-
responseText += ` *(${step.timeframe})*`;
|
|
856
|
-
}
|
|
857
|
-
if (step.reasoning) {
|
|
858
|
-
responseText += `\n - Reasoning: ${step.reasoning}`;
|
|
859
|
-
}
|
|
860
|
-
responseText += `\n`;
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
responseText += `\n`;
|
|
864
|
-
}
|
|
865
|
-
// Key Facts (if available)
|
|
866
|
-
if (synthesis.keyFacts && synthesis.keyFacts.length > 0) {
|
|
867
|
-
responseText += `## 📌 Key Facts\n`;
|
|
868
|
-
synthesis.keyFacts.slice(0, 5).forEach((fact) => {
|
|
869
|
-
if (typeof fact === 'string') {
|
|
870
|
-
responseText += `- ${fact}\n`;
|
|
871
|
-
}
|
|
872
|
-
else if (fact.text) {
|
|
873
|
-
responseText += `- ${fact.text}`;
|
|
874
|
-
if (fact.sourceTitle) {
|
|
875
|
-
responseText += ` *(${fact.sourceTitle})*`;
|
|
876
|
-
}
|
|
877
|
-
responseText += `\n`;
|
|
878
|
-
}
|
|
879
|
-
});
|
|
880
|
-
responseText += `\n`;
|
|
881
|
-
}
|
|
882
|
-
// Source Information
|
|
883
|
-
if (sources && sources.length > 0) {
|
|
884
|
-
responseText += `## 📚 Sources Analyzed\n`;
|
|
885
|
-
sources.forEach((source, idx) => {
|
|
886
|
-
const typeIcons = {
|
|
887
|
-
youtube: "📺",
|
|
888
|
-
x_twitter: "𝕏",
|
|
889
|
-
reddit: "🔗",
|
|
890
|
-
article: "📄",
|
|
891
|
-
pdf: "📑"
|
|
892
|
-
};
|
|
893
|
-
const typeIcon = typeIcons[source.type] || "📄";
|
|
894
|
-
responseText += `${idx + 1}. ${typeIcon} [${source.title}](${source.url})\n`;
|
|
895
|
-
});
|
|
896
|
-
responseText += `\n`;
|
|
897
|
-
}
|
|
898
|
-
// Metadata Footer
|
|
899
|
-
responseText += `---\n`;
|
|
900
|
-
responseText += `*Analysis completed in ${metadata.executionTime ? `${metadata.executionTime}ms` : 'N/A'}`;
|
|
901
|
-
if (metadata.totalTokens) {
|
|
902
|
-
responseText += ` | Processed ${metadata.totalTokens.toLocaleString()} tokens`;
|
|
903
|
-
}
|
|
904
|
-
if (metadata.focusAreas && metadata.focusAreas.length > 0) {
|
|
905
|
-
responseText += ` | Focus: ${metadata.focusAreas.join(', ')}`;
|
|
906
|
-
}
|
|
907
|
-
responseText += `*\n`;
|
|
908
|
-
return {
|
|
909
|
-
content: [
|
|
910
|
-
{
|
|
911
|
-
type: "text",
|
|
912
|
-
text: responseText,
|
|
913
|
-
},
|
|
914
|
-
],
|
|
915
|
-
data: result,
|
|
916
|
-
};
|
|
917
|
-
},
|
|
918
|
-
},
|
|
919
|
-
{
|
|
920
|
-
name: "find_similar_content",
|
|
921
|
-
description: "Find content similar to a specific saved item using semantic similarity.",
|
|
922
|
-
inputSchema: {
|
|
923
|
-
type: "object",
|
|
924
|
-
properties: {
|
|
925
|
-
contentId: {
|
|
926
|
-
type: "string",
|
|
927
|
-
description: "ID of the content to find similar items for",
|
|
928
|
-
},
|
|
929
|
-
limit: {
|
|
930
|
-
type: "number",
|
|
931
|
-
description: "Maximum number of similar items to return",
|
|
932
|
-
default: 5,
|
|
933
|
-
},
|
|
934
|
-
minSimilarity: {
|
|
935
|
-
type: "number",
|
|
936
|
-
description: "Minimum similarity score (0-1)",
|
|
937
|
-
default: 0.7,
|
|
938
|
-
},
|
|
939
|
-
},
|
|
940
|
-
required: ["contentId"],
|
|
941
|
-
},
|
|
942
|
-
modifies: false,
|
|
943
|
-
handler: async (client, args) => {
|
|
944
|
-
const schema = z.object({
|
|
945
|
-
contentId: z.string(),
|
|
946
|
-
limit: z.number().optional().default(5),
|
|
947
|
-
minSimilarity: z.number().optional().default(0.7),
|
|
948
|
-
});
|
|
949
|
-
const params = schema.parse(args);
|
|
950
|
-
const result = await client.findSimilarContent(params.contentId, {
|
|
951
|
-
limit: params.limit,
|
|
952
|
-
minSimilarity: params.minSimilarity,
|
|
953
|
-
});
|
|
954
|
-
let responseText = `# Similar Content to: ${result.source?.title || "Unknown"}\n\n`;
|
|
955
|
-
if (result.similarContent && result.similarContent.length > 0) {
|
|
956
|
-
responseText += `Found ${result.similarContent.length} similar items:\n\n`;
|
|
957
|
-
result.similarContent.forEach((item, idx) => {
|
|
958
|
-
responseText += `## ${idx + 1}. ${item.title || "Untitled"}\n`;
|
|
959
|
-
responseText += `**Similarity:** ${(item.similarity * 100).toFixed(1)}%\n`;
|
|
960
|
-
responseText += `**Type:** ${item.type} | **URL:** ${item.url}\n`;
|
|
961
|
-
if (item.summary) {
|
|
962
|
-
responseText += `**Summary:** ${item.summary}\n`;
|
|
963
|
-
}
|
|
964
|
-
responseText += `\n`;
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
else {
|
|
968
|
-
responseText += `No similar content found with similarity >= ${params.minSimilarity}`;
|
|
969
|
-
}
|
|
970
|
-
return {
|
|
971
|
-
content: [
|
|
972
|
-
{
|
|
973
|
-
type: "text",
|
|
974
|
-
text: responseText,
|
|
975
|
-
},
|
|
976
|
-
],
|
|
977
|
-
data: result,
|
|
978
|
-
};
|
|
979
|
-
},
|
|
980
|
-
},
|
|
981
|
-
{
|
|
982
|
-
name: "batch_get_content",
|
|
983
|
-
description: "Fetch multiple content items in a single request. Efficient for bulk operations.",
|
|
984
|
-
inputSchema: {
|
|
985
|
-
type: "object",
|
|
986
|
-
properties: {
|
|
987
|
-
ids: {
|
|
988
|
-
type: "array",
|
|
989
|
-
items: {
|
|
990
|
-
type: "string",
|
|
991
|
-
},
|
|
992
|
-
description: "Array of content IDs to fetch",
|
|
993
|
-
},
|
|
994
|
-
includeFullContent: {
|
|
995
|
-
type: "boolean",
|
|
996
|
-
description: "Include full text content (warning: may use many tokens)",
|
|
997
|
-
default: false,
|
|
998
|
-
},
|
|
999
|
-
},
|
|
1000
|
-
required: ["ids"],
|
|
1001
|
-
},
|
|
1002
|
-
modifies: false,
|
|
1003
|
-
handler: async (client, args) => {
|
|
1004
|
-
const schema = z.object({
|
|
1005
|
-
ids: z.array(z.string()).min(1).max(50),
|
|
1006
|
-
includeFullContent: z.boolean().optional().default(false),
|
|
1007
|
-
});
|
|
1008
|
-
const params = schema.parse(args);
|
|
1009
|
-
const result = await client.batchGetContent(params.ids, params.includeFullContent);
|
|
1010
|
-
let responseText = `# Batch Content Fetch\n\n`;
|
|
1011
|
-
responseText += `Requested: ${params.ids.length} items\n`;
|
|
1012
|
-
responseText += `Found: ${result.metadata?.found || 0} items\n`;
|
|
1013
|
-
// Calculate and warn about total tokens
|
|
1014
|
-
let totalTokens = 0;
|
|
1015
|
-
if (result.results && result.results.length > 0) {
|
|
1016
|
-
result.results.forEach((item) => {
|
|
1017
|
-
if (item.tokenCount)
|
|
1018
|
-
totalTokens += item.tokenCount;
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
if (params.includeFullContent && totalTokens > 0) {
|
|
1022
|
-
responseText += `\n⚠️ **Full Content Included - Total Size: ${totalTokens.toLocaleString()} tokens**`;
|
|
1023
|
-
if (totalTokens > 100000) {
|
|
1024
|
-
responseText += ` 🚨 EXTREMELY LARGE!\n`;
|
|
1025
|
-
responseText += `WARNING: This WILL consume most or all of your context window!\n`;
|
|
1026
|
-
responseText += `Consider setting includeFullContent: false to just get summaries.\n`;
|
|
1027
|
-
}
|
|
1028
|
-
else if (totalTokens > 50000) {
|
|
1029
|
-
responseText += ` 🚨 VERY LARGE!\n`;
|
|
1030
|
-
responseText += `This is consuming significant context. Use with caution.\n`;
|
|
1031
|
-
}
|
|
1032
|
-
else if (totalTokens > 10000) {
|
|
1033
|
-
responseText += ` ⚠️\n`;
|
|
1034
|
-
}
|
|
1035
|
-
else {
|
|
1036
|
-
responseText += `\n`;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
else if (!params.includeFullContent && totalTokens > 0) {
|
|
1040
|
-
responseText += `\n💡 **Showing summaries only.** Total content available: ~${totalTokens.toLocaleString()} tokens.\n`;
|
|
1041
|
-
responseText += `Rich metadata (summaries, tags, insights) included with minimal token usage.\n`;
|
|
1042
|
-
}
|
|
1043
|
-
responseText += `\n`;
|
|
1044
|
-
if (result.results && result.results.length > 0) {
|
|
1045
|
-
result.results.forEach((item, idx) => {
|
|
1046
|
-
if (item.error) {
|
|
1047
|
-
responseText += `## ${idx + 1}. Error: ${item.id}\n`;
|
|
1048
|
-
responseText += `${item.error}\n\n`;
|
|
1049
|
-
}
|
|
1050
|
-
else {
|
|
1051
|
-
responseText += `## ${idx + 1}. ${item.title || "Untitled"}\n`;
|
|
1052
|
-
responseText += `**ID:** ${item.id}\n`;
|
|
1053
|
-
responseText += `**Type:** ${item.contentType} | **URL:** ${item.url}\n`;
|
|
1054
|
-
if (item.tokenCount) {
|
|
1055
|
-
responseText += `**Tokens:** ${item.tokenCount.toLocaleString()}`;
|
|
1056
|
-
if (item.tokenCount > 10000)
|
|
1057
|
-
responseText += ` ⚠️`;
|
|
1058
|
-
responseText += `\n`;
|
|
1059
|
-
}
|
|
1060
|
-
if (item.summary) {
|
|
1061
|
-
responseText += `**Summary:** ${typeof item.summary === "string" ? item.summary : item.summary.one_sentence || "N/A"}\n`;
|
|
1062
|
-
}
|
|
1063
|
-
if (params.includeFullContent && item.fullContent) {
|
|
1064
|
-
responseText += `**Content Length:** ${item.metadata?.contentLength || 0} characters\n`;
|
|
1065
|
-
}
|
|
1066
|
-
responseText += `\n`;
|
|
1067
|
-
}
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
return {
|
|
1071
|
-
content: [
|
|
1072
|
-
{
|
|
1073
|
-
type: "text",
|
|
1074
|
-
text: responseText,
|
|
1075
|
-
},
|
|
1076
|
-
],
|
|
1077
|
-
data: result,
|
|
1078
|
-
};
|
|
1079
|
-
},
|
|
1080
|
-
},
|
|
27
|
+
// Content retrieval and listing
|
|
28
|
+
listSavedContentTool,
|
|
29
|
+
getContentDetailsTool,
|
|
30
|
+
getRawContentTool,
|
|
31
|
+
batchGetContentTool,
|
|
32
|
+
// Search and discovery
|
|
33
|
+
searchContentTool,
|
|
34
|
+
findSimilarContentTool,
|
|
35
|
+
expandSearchTool,
|
|
36
|
+
// Analysis and synthesis
|
|
37
|
+
synthesizeContentTool,
|
|
38
|
+
exploreTopicTool,
|
|
39
|
+
findConnectionsTool,
|
|
40
|
+
extractInsightsTool,
|
|
41
|
+
getTimelineTool,
|
|
42
|
+
buildKnowledgeGraphTool,
|
|
43
|
+
extractFrameworksTool,
|
|
44
|
+
findExamplesTool,
|
|
45
|
+
buildNarrativeTool,
|
|
46
|
+
// Actions and goals
|
|
47
|
+
listActionsTool,
|
|
48
|
+
completeActionTool,
|
|
49
|
+
listGoalsTool,
|
|
50
|
+
// Content management
|
|
51
|
+
saveContentTool,
|
|
52
|
+
smartSectionsTool,
|
|
53
|
+
// Utility and planning
|
|
54
|
+
estimateSearchTokensTool,
|
|
55
|
+
getInstructionsTool,
|
|
56
|
+
planQueryTool,
|
|
1081
57
|
];
|
|
58
|
+
// Export individual tools for testing or specific usage
|
|
59
|
+
export { listSavedContentTool, getContentDetailsTool, searchContentTool, saveContentTool, listActionsTool, completeActionTool, listGoalsTool, estimateSearchTokensTool, synthesizeContentTool, findSimilarContentTool, batchGetContentTool, getInstructionsTool, planQueryTool, getRawContentTool, exploreTopicTool, findConnectionsTool, extractInsightsTool, getTimelineTool, buildKnowledgeGraphTool, extractFrameworksTool, findExamplesTool, buildNarrativeTool, expandSearchTool, smartSectionsTool, };
|
|
1082
60
|
//# sourceMappingURL=index.js.map
|