noverload-mcp 0.7.7 → 0.8.1

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.
Files changed (30) hide show
  1. package/dist/client.d.ts +2 -1
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +40 -7
  4. package/dist/client.js.map +1 -1
  5. package/dist/index.js +27 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/tools/implementations/batch-get.d.ts.map +1 -1
  8. package/dist/tools/implementations/batch-get.js +34 -14
  9. package/dist/tools/implementations/batch-get.js.map +1 -1
  10. package/dist/tools/implementations/extract-frameworks.d.ts.map +1 -1
  11. package/dist/tools/implementations/extract-frameworks.js +73 -45
  12. package/dist/tools/implementations/extract-frameworks.js.map +1 -1
  13. package/dist/tools/implementations/get-content.d.ts.map +1 -1
  14. package/dist/tools/implementations/get-content.js +41 -11
  15. package/dist/tools/implementations/get-content.js.map +1 -1
  16. package/dist/tools/implementations/list-content.d.ts.map +1 -1
  17. package/dist/tools/implementations/list-content.js +12 -2
  18. package/dist/tools/implementations/list-content.js.map +1 -1
  19. package/dist/tools/implementations/search.d.ts.map +1 -1
  20. package/dist/tools/implementations/search.js +96 -13
  21. package/dist/tools/implementations/search.js.map +1 -1
  22. package/dist/tools/index.d.ts +1 -3
  23. package/dist/tools/index.d.ts.map +1 -1
  24. package/dist/tools/index.js +21 -7
  25. package/dist/tools/index.js.map +1 -1
  26. package/dist/tools/utils/context-warnings.d.ts +27 -0
  27. package/dist/tools/utils/context-warnings.d.ts.map +1 -0
  28. package/dist/tools/utils/context-warnings.js +120 -0
  29. package/dist/tools/utils/context-warnings.js.map +1 -0
  30. package/package.json +1 -1
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Token thresholds for warnings
3
+ */
4
+ export const TOKEN_THRESHOLDS = {
5
+ SMALL: 1000, // No warning needed
6
+ MEDIUM: 5000, // Mild warning
7
+ LARGE: 10000, // Strong warning
8
+ HUGE: 50000, // Critical warning - requires confirmation
9
+ MASSIVE: 100000, // Extreme warning - strongly discourage
10
+ };
11
+ /**
12
+ * Get warning level based on token count
13
+ */
14
+ export function getTokenWarningLevel(tokens) {
15
+ if (tokens < TOKEN_THRESHOLDS.SMALL)
16
+ return "none";
17
+ if (tokens < TOKEN_THRESHOLDS.MEDIUM)
18
+ return "mild";
19
+ if (tokens < TOKEN_THRESHOLDS.LARGE)
20
+ return "strong";
21
+ if (tokens < TOKEN_THRESHOLDS.HUGE)
22
+ return "critical";
23
+ return "extreme";
24
+ }
25
+ /**
26
+ * Generate warning message for token consumption
27
+ */
28
+ export function generateTokenWarning(tokens, operation, itemCount) {
29
+ const level = getTokenWarningLevel(tokens);
30
+ if (level === "none")
31
+ return "";
32
+ const itemsText = itemCount ? ` for ${itemCount} items` : "";
33
+ switch (level) {
34
+ case "mild":
35
+ return `\n📊 **Note:** This ${operation}${itemsText} will use ~${tokens.toLocaleString()} tokens.`;
36
+ case "strong":
37
+ return `\n⚠️ **Warning:** This ${operation}${itemsText} will consume ~${tokens.toLocaleString()} tokens (significant context usage).`;
38
+ case "critical":
39
+ return `\n🚨 **Critical Warning:** This ${operation}${itemsText} will consume ~${tokens.toLocaleString()} tokens!\n` +
40
+ `This is a very large amount that may use up most of your context window.\n` +
41
+ `Consider:\n` +
42
+ `• Limiting your search/request to fewer items\n` +
43
+ `• Using specific filters to reduce results\n` +
44
+ `• Requesting content without full text (summaries only)`;
45
+ case "extreme":
46
+ return `\n🛑 **EXTREME WARNING:** This ${operation}${itemsText} would consume ~${tokens.toLocaleString()} tokens!\n` +
47
+ `This exceeds typical LLM context windows and is strongly discouraged.\n` +
48
+ `**Recommendations:**\n` +
49
+ `• Break down your request into smaller chunks\n` +
50
+ `• Use more specific search queries\n` +
51
+ `• Request summaries instead of full content\n` +
52
+ `• Use the batch_get_content tool with specific IDs`;
53
+ }
54
+ }
55
+ /**
56
+ * Generate a preview response when content is too large
57
+ */
58
+ export function generatePreviewResponse(content, actualTokens, operation) {
59
+ let response = `# ⚠️ Large Content Warning\n\n`;
60
+ response += `The ${operation} would return ~${actualTokens.toLocaleString()} tokens.\n\n`;
61
+ response += `## Options:\n`;
62
+ response += `1. **Get summary only** - Use without \`includeFullContent\` flag\n`;
63
+ response += `2. **Get specific sections** - Use the \`smart_sections\` tool\n`;
64
+ response += `3. **Accept full content** - Re-run with \`acceptLargeContent: true\` parameter\n\n`;
65
+ response += `## Content Preview:\n`;
66
+ response += `**Title:** ${content.title || 'Untitled'}\n`;
67
+ response += `**Type:** ${content.contentType}\n`;
68
+ response += `**URL:** ${content.url}\n`;
69
+ if (content.summary) {
70
+ const summaryObj = typeof content.summary === 'string'
71
+ ? { text: content.summary }
72
+ : content.summary;
73
+ if (summaryObj.one_sentence) {
74
+ response += `\n**Summary:** ${summaryObj.one_sentence}\n`;
75
+ }
76
+ }
77
+ return response;
78
+ }
79
+ /**
80
+ * Instructions for LLMs on how to handle large content requests
81
+ */
82
+ export const CONTEXT_MANAGEMENT_INSTRUCTIONS = `
83
+ ## Context Management Instructions for LLMs
84
+
85
+ When users request content from Noverload, be mindful of token consumption:
86
+
87
+ ### Before Returning Large Content:
88
+
89
+ 1. **Check Token Count**: If content exceeds 10,000 tokens, warn the user
90
+ 2. **Suggest Alternatives**:
91
+ - Use summaries instead of full text
92
+ - Use smart_sections for specific parts
93
+ - Filter searches more narrowly
94
+ 3. **Require Confirmation**: For content over 50,000 tokens, ask for explicit confirmation
95
+
96
+ ### Best Practices:
97
+
98
+ - Start with summaries and metadata
99
+ - Only fetch full content when specifically needed
100
+ - Use batch operations efficiently
101
+ - Guide users to more targeted queries
102
+
103
+ ### Warning Thresholds:
104
+
105
+ - < 1,000 tokens: No warning needed
106
+ - 1,000-5,000 tokens: Note the size
107
+ - 5,000-10,000 tokens: Mild warning
108
+ - 10,000-50,000 tokens: Strong warning with alternatives
109
+ - > 50,000 tokens: Require explicit confirmation
110
+
111
+ ### Example User Interaction:
112
+
113
+ User: "Show me all my saved content about AI"
114
+ Assistant: "I found 45 items about AI. Getting full content for all would use ~250,000 tokens.
115
+ Would you like to:
116
+ 1. See summaries only (recommended)
117
+ 2. Filter to specific types (YouTube, articles, etc.)
118
+ 3. Search for a more specific AI topic"
119
+ `;
120
+ //# sourceMappingURL=context-warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-warnings.js","sourceRoot":"","sources":["../../../src/tools/utils/context-warnings.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,IAAI,EAAO,oBAAoB;IACtC,MAAM,EAAE,IAAI,EAAM,eAAe;IACjC,KAAK,EAAE,KAAK,EAAM,mBAAmB;IACrC,IAAI,EAAE,KAAK,EAAO,2CAA2C;IAC7D,OAAO,EAAE,MAAM,EAAG,wCAAwC;CAClD,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,IAAI,MAAM,GAAG,gBAAgB,CAAC,KAAK;QAAE,OAAO,MAAM,CAAC;IACnD,IAAI,MAAM,GAAG,gBAAgB,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IACpD,IAAI,MAAM,GAAG,gBAAgB,CAAC,KAAK;QAAE,OAAO,QAAQ,CAAC;IACrD,IAAI,MAAM,GAAG,gBAAgB,CAAC,IAAI;QAAE,OAAO,UAAU,CAAC;IACtD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAc,EACd,SAAiB,EACjB,SAAkB;IAElB,MAAM,KAAK,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAE3C,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IAEhC,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAE7D,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM;YACT,OAAO,uBA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AAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE;YAC3B,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QAEpB,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;YAC5B,QAAQ,IAAI,kBAAkB,UAAU,CAAC,YAAY,IAAI,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC9C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noverload-mcp",
3
- "version": "0.7.7",
3
+ "version": "0.8.1",
4
4
  "description": "MCP server for Noverload - Access saved content in AI tools with advanced search, synthesis, and token management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",