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
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const inputSchema = z.object({
|
|
3
|
+
story: z.string().describe("The story or narrative you want to build"),
|
|
4
|
+
goal: z.string().describe("The goal or purpose of this narrative (e.g., 'pitch deck', 'origin story', 'case study')"),
|
|
5
|
+
maxSources: z.number().optional().default(10).describe("Maximum number of sources to use"),
|
|
6
|
+
includeFrameworks: z.boolean().optional().default(true).describe("Include relevant frameworks"),
|
|
7
|
+
includeExamples: z.boolean().optional().default(true).describe("Include supporting examples"),
|
|
8
|
+
});
|
|
9
|
+
export const buildNarrativeTool = {
|
|
10
|
+
name: "noverload_build_narrative",
|
|
11
|
+
description: "Build a structured narrative using your saved content. Automatically finds supporting content, frameworks, and examples to craft compelling stories for pitches, presentations, or case studies.",
|
|
12
|
+
inputSchema: inputSchema.strict(),
|
|
13
|
+
modifies: false,
|
|
14
|
+
handler: async (client, args) => {
|
|
15
|
+
const input = inputSchema.parse(args);
|
|
16
|
+
try {
|
|
17
|
+
// Step 1: Search for relevant content
|
|
18
|
+
const searchQuery = `${input.story} ${input.goal}`;
|
|
19
|
+
const searchResults = await client.searchContentV2({
|
|
20
|
+
query: searchQuery,
|
|
21
|
+
mode: "all",
|
|
22
|
+
limit: input.maxSources * 2, // Get extra to filter
|
|
23
|
+
});
|
|
24
|
+
if (!searchResults.results || searchResults.results.length === 0) {
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: "text",
|
|
29
|
+
text: `🔍 No relevant content found for building your narrative about "${input.story}". Try saving more content related to this topic first.`
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
data: {
|
|
33
|
+
narrative: null,
|
|
34
|
+
searchQuery: searchQuery
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// Step 2: Find frameworks if requested
|
|
39
|
+
let relevantFrameworks = [];
|
|
40
|
+
if (input.includeFrameworks) {
|
|
41
|
+
// Look for frameworks in the content
|
|
42
|
+
for (const content of searchResults.results.slice(0, input.maxSources)) {
|
|
43
|
+
if (content.aiInsights?.frameworks) {
|
|
44
|
+
relevantFrameworks.push(...content.aiInsights.frameworks);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Step 3: Find examples if requested
|
|
49
|
+
let relevantExamples = [];
|
|
50
|
+
if (input.includeExamples) {
|
|
51
|
+
// Look for examples in the content
|
|
52
|
+
for (const content of searchResults.results.slice(0, input.maxSources)) {
|
|
53
|
+
if (content.aiInsights?.extracted_examples) {
|
|
54
|
+
relevantExamples.push(...content.aiInsights.extracted_examples);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Step 4: Build the narrative structure
|
|
59
|
+
const narrative = {
|
|
60
|
+
title: input.story,
|
|
61
|
+
purpose: input.goal,
|
|
62
|
+
summary: `A ${input.goal} about ${input.story}, supported by insights from ${Math.min(searchResults.results.length, input.maxSources)} sources.`,
|
|
63
|
+
sections: [],
|
|
64
|
+
keyTakeaways: []
|
|
65
|
+
};
|
|
66
|
+
// Determine sections based on goal type
|
|
67
|
+
const sectionTemplates = getSectionTemplates(input.goal);
|
|
68
|
+
// Build each section
|
|
69
|
+
for (const template of sectionTemplates) {
|
|
70
|
+
const section = {
|
|
71
|
+
title: template.title,
|
|
72
|
+
content: "",
|
|
73
|
+
supportingSources: [],
|
|
74
|
+
frameworks: [],
|
|
75
|
+
examples: []
|
|
76
|
+
};
|
|
77
|
+
// Find relevant content for this section
|
|
78
|
+
const relevantContent = searchResults.results
|
|
79
|
+
.filter((content) => {
|
|
80
|
+
// Match content to section based on keywords
|
|
81
|
+
const contentText = (content.summary?.toString() || "") + (content.keyInsights?.join(" ") || "");
|
|
82
|
+
return template.keywords.some((keyword) => contentText.toLowerCase().includes(keyword.toLowerCase()));
|
|
83
|
+
})
|
|
84
|
+
.slice(0, 3); // Max 3 sources per section
|
|
85
|
+
// Build section content
|
|
86
|
+
if (relevantContent.length > 0) {
|
|
87
|
+
section.content = template.prompt;
|
|
88
|
+
// Add supporting sources
|
|
89
|
+
for (const content of relevantContent) {
|
|
90
|
+
const insight = content.keyInsights?.[0] ||
|
|
91
|
+
(typeof content.summary === 'string' ? content.summary.substring(0, 100) : "");
|
|
92
|
+
section.supportingSources.push({
|
|
93
|
+
id: content.id,
|
|
94
|
+
title: content.title || "Untitled",
|
|
95
|
+
url: content.url,
|
|
96
|
+
relevantInsight: insight
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
// Add relevant frameworks
|
|
100
|
+
if (input.includeFrameworks && relevantFrameworks.length > 0) {
|
|
101
|
+
const applicableFrameworks = relevantFrameworks
|
|
102
|
+
.filter((fw) => fw.useCases?.some((uc) => template.keywords.some((kw) => uc.toLowerCase().includes(kw.toLowerCase()))))
|
|
103
|
+
.slice(0, 2);
|
|
104
|
+
section.frameworks = applicableFrameworks.map(fw => ({
|
|
105
|
+
name: fw.name,
|
|
106
|
+
application: `Apply ${fw.name} to ${template.application}`
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
// Add relevant examples
|
|
110
|
+
if (input.includeExamples && relevantExamples.length > 0) {
|
|
111
|
+
const applicableExamples = relevantExamples
|
|
112
|
+
.filter(ex => template.exampleTypes.includes(ex.type))
|
|
113
|
+
.slice(0, 2);
|
|
114
|
+
section.examples = applicableExamples.map(ex => ({
|
|
115
|
+
description: ex.description,
|
|
116
|
+
relevance: `Shows ${template.exampleRelevance}`
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
narrative.sections.push(section);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Generate key takeaways
|
|
123
|
+
narrative.keyTakeaways = generateKeyTakeaways(narrative.sections);
|
|
124
|
+
// Add call to action based on goal
|
|
125
|
+
narrative.callToAction = getCallToAction(input.goal);
|
|
126
|
+
// Format response
|
|
127
|
+
let responseText = `📖 **${narrative.title}**\n`;
|
|
128
|
+
responseText += `*Purpose: ${narrative.purpose}*\n\n`;
|
|
129
|
+
responseText += `${narrative.summary}\n\n`;
|
|
130
|
+
// Output each section
|
|
131
|
+
for (const section of narrative.sections) {
|
|
132
|
+
responseText += `## ${section.title}\n\n`;
|
|
133
|
+
responseText += `${section.content}\n\n`;
|
|
134
|
+
if (section.supportingSources.length > 0) {
|
|
135
|
+
responseText += `**Supporting Evidence:**\n`;
|
|
136
|
+
for (const source of section.supportingSources) {
|
|
137
|
+
const icon = source.url.includes('youtube') ? '📺' :
|
|
138
|
+
source.url.includes('twitter') ? '𝕏' :
|
|
139
|
+
source.url.includes('reddit') ? '🟠' : '📖';
|
|
140
|
+
responseText += `- ${icon} [${source.title}](${source.url}): "${source.relevantInsight}"\n`;
|
|
141
|
+
}
|
|
142
|
+
responseText += `\n`;
|
|
143
|
+
}
|
|
144
|
+
if (section.frameworks && section.frameworks.length > 0) {
|
|
145
|
+
responseText += `**Applicable Frameworks:**\n`;
|
|
146
|
+
for (const fw of section.frameworks) {
|
|
147
|
+
responseText += `- 🎯 **${fw.name}**: ${fw.application}\n`;
|
|
148
|
+
}
|
|
149
|
+
responseText += `\n`;
|
|
150
|
+
}
|
|
151
|
+
if (section.examples && section.examples.length > 0) {
|
|
152
|
+
responseText += `**Examples:**\n`;
|
|
153
|
+
for (const ex of section.examples) {
|
|
154
|
+
responseText += `- 📊 ${ex.description} (${ex.relevance})\n`;
|
|
155
|
+
}
|
|
156
|
+
responseText += `\n`;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Add key takeaways
|
|
160
|
+
if (narrative.keyTakeaways.length > 0) {
|
|
161
|
+
responseText += `## 🎯 Key Takeaways\n\n`;
|
|
162
|
+
for (const takeaway of narrative.keyTakeaways) {
|
|
163
|
+
responseText += `- ${takeaway}\n`;
|
|
164
|
+
}
|
|
165
|
+
responseText += `\n`;
|
|
166
|
+
}
|
|
167
|
+
// Add call to action
|
|
168
|
+
if (narrative.callToAction) {
|
|
169
|
+
responseText += `## 🚀 ${narrative.callToAction}\n\n`;
|
|
170
|
+
}
|
|
171
|
+
// Add metadata
|
|
172
|
+
responseText += `---\n`;
|
|
173
|
+
responseText += `*Built from ${narrative.sections.reduce((acc, s) => acc + s.supportingSources.length, 0)} sources`;
|
|
174
|
+
if (relevantFrameworks.length > 0) {
|
|
175
|
+
responseText += `, ${relevantFrameworks.length} frameworks`;
|
|
176
|
+
}
|
|
177
|
+
if (relevantExamples.length > 0) {
|
|
178
|
+
responseText += `, ${relevantExamples.length} examples`;
|
|
179
|
+
}
|
|
180
|
+
responseText += `*\n`;
|
|
181
|
+
return {
|
|
182
|
+
content: [
|
|
183
|
+
{
|
|
184
|
+
type: "text",
|
|
185
|
+
text: responseText
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
data: {
|
|
189
|
+
narrative: narrative,
|
|
190
|
+
totalSources: searchResults.results.length,
|
|
191
|
+
frameworksFound: relevantFrameworks.length,
|
|
192
|
+
examplesFound: relevantExamples.length,
|
|
193
|
+
searchQuery: searchQuery
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
console.error("Build narrative error:", error);
|
|
199
|
+
return {
|
|
200
|
+
content: [
|
|
201
|
+
{
|
|
202
|
+
type: "text",
|
|
203
|
+
text: `❌ Error building narrative: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
error: true
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
// Helper function to get section templates based on goal
|
|
212
|
+
function getSectionTemplates(goal) {
|
|
213
|
+
const goalLower = goal.toLowerCase();
|
|
214
|
+
if (goalLower.includes('pitch') || goalLower.includes('investor')) {
|
|
215
|
+
return [
|
|
216
|
+
{
|
|
217
|
+
title: "The Problem",
|
|
218
|
+
prompt: "Define the problem your audience faces",
|
|
219
|
+
keywords: ["problem", "challenge", "pain", "issue", "struggle"],
|
|
220
|
+
application: "frame the problem",
|
|
221
|
+
exampleTypes: ["failure", "case_study"],
|
|
222
|
+
exampleRelevance: "the problem is real"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
title: "The Solution",
|
|
226
|
+
prompt: "Present your unique solution",
|
|
227
|
+
keywords: ["solution", "solve", "answer", "approach", "method"],
|
|
228
|
+
application: "present the solution",
|
|
229
|
+
exampleTypes: ["success_story", "transformation"],
|
|
230
|
+
exampleRelevance: "the solution works"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
title: "Market Opportunity",
|
|
234
|
+
prompt: "Demonstrate the size and potential",
|
|
235
|
+
keywords: ["market", "opportunity", "growth", "potential", "size"],
|
|
236
|
+
application: "size the opportunity",
|
|
237
|
+
exampleTypes: ["case_study", "success_story"],
|
|
238
|
+
exampleRelevance: "market validation"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
title: "The Ask",
|
|
242
|
+
prompt: "Make your specific request",
|
|
243
|
+
keywords: ["investment", "funding", "support", "partnership"],
|
|
244
|
+
application: "structure the ask",
|
|
245
|
+
exampleTypes: ["success_story"],
|
|
246
|
+
exampleRelevance: "successful outcomes"
|
|
247
|
+
}
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
else if (goalLower.includes('origin') || goalLower.includes('story')) {
|
|
251
|
+
return [
|
|
252
|
+
{
|
|
253
|
+
title: "The Beginning",
|
|
254
|
+
prompt: "Where the journey started",
|
|
255
|
+
keywords: ["start", "begin", "origin", "founded", "created"],
|
|
256
|
+
application: "set the scene",
|
|
257
|
+
exampleTypes: ["transformation"],
|
|
258
|
+
exampleRelevance: "humble beginnings"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
title: "The Challenge",
|
|
262
|
+
prompt: "The obstacles faced",
|
|
263
|
+
keywords: ["challenge", "obstacle", "difficulty", "struggle"],
|
|
264
|
+
application: "create tension",
|
|
265
|
+
exampleTypes: ["failure", "case_study"],
|
|
266
|
+
exampleRelevance: "overcoming adversity"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
title: "The Transformation",
|
|
270
|
+
prompt: "The pivotal moment or realization",
|
|
271
|
+
keywords: ["transform", "change", "pivot", "realize", "discover"],
|
|
272
|
+
application: "show growth",
|
|
273
|
+
exampleTypes: ["transformation", "success_story"],
|
|
274
|
+
exampleRelevance: "breakthrough moments"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
title: "The Impact",
|
|
278
|
+
prompt: "The results and future vision",
|
|
279
|
+
keywords: ["impact", "result", "outcome", "success", "future"],
|
|
280
|
+
application: "demonstrate value",
|
|
281
|
+
exampleTypes: ["success_story", "case_study"],
|
|
282
|
+
exampleRelevance: "meaningful impact"
|
|
283
|
+
}
|
|
284
|
+
];
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
// Generic narrative structure
|
|
288
|
+
return [
|
|
289
|
+
{
|
|
290
|
+
title: "Context",
|
|
291
|
+
prompt: "Set the context and background",
|
|
292
|
+
keywords: ["background", "context", "situation", "overview"],
|
|
293
|
+
application: "establish context",
|
|
294
|
+
exampleTypes: ["case_study"],
|
|
295
|
+
exampleRelevance: "similar situations"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
title: "Key Points",
|
|
299
|
+
prompt: "Present the main arguments or insights",
|
|
300
|
+
keywords: ["key", "main", "important", "critical", "essential"],
|
|
301
|
+
application: "structure arguments",
|
|
302
|
+
exampleTypes: ["case_study", "success_story"],
|
|
303
|
+
exampleRelevance: "supporting evidence"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
title: "Evidence",
|
|
307
|
+
prompt: "Provide supporting evidence",
|
|
308
|
+
keywords: ["evidence", "proof", "data", "results", "metrics"],
|
|
309
|
+
application: "validate points",
|
|
310
|
+
exampleTypes: ["case_study", "success_story"],
|
|
311
|
+
exampleRelevance: "concrete proof"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
title: "Conclusion",
|
|
315
|
+
prompt: "Summarize and call to action",
|
|
316
|
+
keywords: ["conclusion", "summary", "therefore", "action"],
|
|
317
|
+
application: "drive action",
|
|
318
|
+
exampleTypes: ["transformation", "success_story"],
|
|
319
|
+
exampleRelevance: "desired outcomes"
|
|
320
|
+
}
|
|
321
|
+
];
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
// Helper function to generate key takeaways
|
|
325
|
+
function generateKeyTakeaways(sections) {
|
|
326
|
+
const takeaways = [];
|
|
327
|
+
for (const section of sections) {
|
|
328
|
+
if (section.supportingSources.length > 0) {
|
|
329
|
+
// Generate a takeaway from the section
|
|
330
|
+
const sectionTakeaway = `${section.title}: ${section.supportingSources[0].relevantInsight.substring(0, 100)}`;
|
|
331
|
+
takeaways.push(sectionTakeaway);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return takeaways.slice(0, 5); // Max 5 takeaways
|
|
335
|
+
}
|
|
336
|
+
// Helper function to get call to action
|
|
337
|
+
function getCallToAction(goal) {
|
|
338
|
+
const goalLower = goal.toLowerCase();
|
|
339
|
+
if (goalLower.includes('pitch') || goalLower.includes('investor')) {
|
|
340
|
+
return "Next Steps: Schedule a meeting to discuss how we can work together";
|
|
341
|
+
}
|
|
342
|
+
else if (goalLower.includes('origin') || goalLower.includes('story')) {
|
|
343
|
+
return "Join Us: Be part of the next chapter in our story";
|
|
344
|
+
}
|
|
345
|
+
else if (goalLower.includes('case study')) {
|
|
346
|
+
return "Learn More: Discover how you can achieve similar results";
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
return "Take Action: Apply these insights to your own journey";
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=build-narrative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-narrative.js","sourceRoot":"","sources":["../../../src/tools/implementations/build-narrative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;IACtE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0FAA0F,CAAC;IACrH,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC1F,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC/F,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CAC9F,CAAC,CAAC;AA8BH,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACtC,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,kMAAkM;IAC/M,WAAW,EAAE,WAAW,CAAC,MAAM,EAAwC;IACvE,QAAQ,EAAE,KAAK;IAEf,OAAO,EAAE,KAAK,EAAE,MAAuB,EAAE,IAAa,EAAE,EAAE;QACxD,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEtC,I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,CAAC;SAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACvE,OAAO,mDAAmD,CAAC;IAC7D,CAAC;SAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5C,OAAO,0DAA0D,CAAC;IACpE,CAAC;SAAM,CAAC;QACN,OAAO,uDAAuD,CAAC;IACjE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-tokens.d.ts","sourceRoot":"","sources":["../../../src/tools/implementations/estimate-tokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,eAAO,MAAM,wBAAwB,EAAE,IAuDtC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const estimateSearchTokensTool = {
|
|
3
|
+
name: "estimate_search_tokens",
|
|
4
|
+
description: "Estimate token usage before performing a search. Helps manage context window and API costs.",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
query: {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: "Search query to estimate",
|
|
11
|
+
},
|
|
12
|
+
limit: {
|
|
13
|
+
type: "number",
|
|
14
|
+
description: "Number of results to estimate for",
|
|
15
|
+
default: 10,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ["query"],
|
|
19
|
+
},
|
|
20
|
+
modifies: false,
|
|
21
|
+
handler: async (client, args) => {
|
|
22
|
+
const schema = z.object({
|
|
23
|
+
query: z.string(),
|
|
24
|
+
limit: z.number().optional().default(10),
|
|
25
|
+
});
|
|
26
|
+
const params = schema.parse(args);
|
|
27
|
+
const estimate = await client.estimateSearchTokens(params.query, params.limit);
|
|
28
|
+
let responseText = `# Token Estimate for: "${params.query}"\n\n`;
|
|
29
|
+
responseText += `**Total Estimated Tokens:** ${estimate.totals?.estimatedTokens || 0}\n`;
|
|
30
|
+
responseText += `**Recommendation:** ${estimate.recommendation || "Unknown"}\n\n`;
|
|
31
|
+
if (estimate.costEstimate) {
|
|
32
|
+
responseText += `## Estimated Costs\n`;
|
|
33
|
+
responseText += `- GPT-4: ${estimate.costEstimate.gpt4}\n`;
|
|
34
|
+
responseText += `- GPT-3.5: ${estimate.costEstimate.gpt35}\n`;
|
|
35
|
+
responseText += `- Claude 3: ${estimate.costEstimate.claude3}\n\n`;
|
|
36
|
+
}
|
|
37
|
+
if (estimate.estimates && estimate.estimates.length > 0) {
|
|
38
|
+
responseText += `## Content Breakdown\n`;
|
|
39
|
+
estimate.estimates.forEach((item, idx) => {
|
|
40
|
+
responseText += `${idx + 1}. ${item.title || "Untitled"} - ${item.estimatedTokens} tokens\n`;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: "text",
|
|
47
|
+
text: responseText,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
data: estimate,
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=estimate-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-tokens.js","sourceRoot":"","sources":["../../../src/tools/implementations/estimate-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,wBAAwB,GAAS;IAC5C,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,6FAA6F;IAC1G,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0BAA0B;aACxC;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;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