natureco-cli 2.13.11 → 2.13.12
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/package.json +1 -1
- package/src/commands/dashboard.js +2 -2
- package/src/utils/api.js +26 -2
package/package.json
CHANGED
|
@@ -211,7 +211,7 @@ body::before{
|
|
|
211
211
|
<div class="header-bot-name" id="header-bot-name">Nature Bot</div>
|
|
212
212
|
<div class="header-bot-model" id="header-bot-model">NatureCo</div>
|
|
213
213
|
</div>
|
|
214
|
-
<div class="version-badge" id="version-badge">v2.13.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.13.12</div>
|
|
215
215
|
</div>
|
|
216
216
|
<div class="messages" id="messages"></div>
|
|
217
217
|
<div class="input-area">
|
|
@@ -341,7 +341,7 @@ function dashboard(action) {
|
|
|
341
341
|
apiKey: cfg.apiKey,
|
|
342
342
|
defaultBot: cfg.defaultBot,
|
|
343
343
|
defaultBotId: cfg.defaultBotId,
|
|
344
|
-
version: 'v2.13.
|
|
344
|
+
version: 'v2.13.12',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/utils/api.js
CHANGED
|
@@ -172,6 +172,30 @@ function normalizeMcpToolSchema(tool) {
|
|
|
172
172
|
return { ...tool, inputSchema: normalizedSchema };
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Minimize MCP tool schema to reduce token usage
|
|
177
|
+
* Truncates descriptions and removes unnecessary fields
|
|
178
|
+
*/
|
|
179
|
+
function minimizeMcpTool(tool) {
|
|
180
|
+
return {
|
|
181
|
+
name: tool.name,
|
|
182
|
+
description: (tool.description || '').slice(0, 100),
|
|
183
|
+
inputSchema: {
|
|
184
|
+
type: tool.inputSchema?.type || 'object',
|
|
185
|
+
properties: Object.fromEntries(
|
|
186
|
+
Object.entries(tool.inputSchema?.properties || {}).map(([k, v]) => [
|
|
187
|
+
k,
|
|
188
|
+
{
|
|
189
|
+
type: v.type,
|
|
190
|
+
...(v.enum ? { enum: v.enum } : {}) // Include enum only if exists
|
|
191
|
+
}
|
|
192
|
+
])
|
|
193
|
+
),
|
|
194
|
+
required: tool.inputSchema?.required || []
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
175
199
|
/**
|
|
176
200
|
* Coerce MCP tool parameters to match schema types
|
|
177
201
|
*/
|
|
@@ -370,7 +394,7 @@ function getProviderConfig() {
|
|
|
370
394
|
*/
|
|
371
395
|
function formatToolsForOpenAI() {
|
|
372
396
|
const localTools = getToolDefinitions();
|
|
373
|
-
const mcpTools = getMcpToolsForAI(); //
|
|
397
|
+
const mcpTools = getMcpToolsForAI().map(minimizeMcpTool); // Minimize MCP tools
|
|
374
398
|
|
|
375
399
|
// Normalize MCP tools before combining
|
|
376
400
|
const normalizedMcpTools = mcpTools.map(tool => normalizeMcpToolSchema(tool));
|
|
@@ -393,7 +417,7 @@ function formatToolsForOpenAI() {
|
|
|
393
417
|
*/
|
|
394
418
|
function formatToolsForAnthropic() {
|
|
395
419
|
const localTools = getToolDefinitions();
|
|
396
|
-
const mcpTools = getMcpToolsForAI(); //
|
|
420
|
+
const mcpTools = getMcpToolsForAI().map(minimizeMcpTool); // Minimize MCP tools
|
|
397
421
|
|
|
398
422
|
// Normalize MCP tools before combining
|
|
399
423
|
const normalizedMcpTools = mcpTools.map(tool => normalizeMcpToolSchema(tool));
|