natureco-cli 2.10.5 → 2.10.7
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
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.10.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.10.7</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.10.
|
|
344
|
+
version: 'v2.10.7',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
|
@@ -138,7 +138,7 @@ async function startGateway() {
|
|
|
138
138
|
|
|
139
139
|
async function runGatewayWorker() {
|
|
140
140
|
// This runs in the background
|
|
141
|
-
log('gateway', 'Starting NatureCo Gateway v2.10.
|
|
141
|
+
log('gateway', 'Starting NatureCo Gateway v2.10.7...', 'green');
|
|
142
142
|
|
|
143
143
|
// Load config
|
|
144
144
|
const { getConfig } = require('../utils/config');
|
package/src/utils/api.js
CHANGED
|
@@ -140,6 +140,8 @@ function getMcpTools() {
|
|
|
140
140
|
* Execute MCP tool call
|
|
141
141
|
*/
|
|
142
142
|
async function executeMcpTool(toolName, toolArgs) {
|
|
143
|
+
console.log('[DEBUG] EXECUTING MCP TOOL:', toolName, 'Args:', JSON.stringify(toolArgs).slice(0, 100));
|
|
144
|
+
|
|
143
145
|
// Find which server has this tool
|
|
144
146
|
for (const [serverName, { client, tools }] of Object.entries(mcpClients)) {
|
|
145
147
|
const tool = tools.find(t => t.name === toolName);
|
|
@@ -150,6 +152,8 @@ async function executeMcpTool(toolName, toolArgs) {
|
|
|
150
152
|
try {
|
|
151
153
|
const result = await client.callTool(toolName, toolArgs);
|
|
152
154
|
|
|
155
|
+
console.log('[DEBUG] MCP RAW RESULT:', JSON.stringify(result).slice(0, 200));
|
|
156
|
+
|
|
153
157
|
// MCP returns { content: [{ type: 'text', text: '...' }] }
|
|
154
158
|
if (result.content && result.content.length > 0) {
|
|
155
159
|
// Extract all text content and join with newlines
|
|
@@ -158,20 +162,25 @@ async function executeMcpTool(toolName, toolArgs) {
|
|
|
158
162
|
.map(c => c.text);
|
|
159
163
|
|
|
160
164
|
if (textContents.length > 0) {
|
|
165
|
+
const output = textContents.join('\n');
|
|
166
|
+
console.log('[DEBUG] MCP FORMATTED OUTPUT:', output.slice(0, 100));
|
|
161
167
|
return {
|
|
162
168
|
success: true,
|
|
163
|
-
output:
|
|
169
|
+
output: output
|
|
164
170
|
};
|
|
165
171
|
}
|
|
166
172
|
}
|
|
167
173
|
|
|
168
174
|
// Fallback: return entire result as JSON
|
|
175
|
+
const fallbackOutput = JSON.stringify(result, null, 2);
|
|
176
|
+
console.log('[DEBUG] MCP FALLBACK OUTPUT:', fallbackOutput.slice(0, 100));
|
|
169
177
|
return {
|
|
170
178
|
success: true,
|
|
171
|
-
output:
|
|
179
|
+
output: fallbackOutput
|
|
172
180
|
};
|
|
173
181
|
|
|
174
182
|
} catch (err) {
|
|
183
|
+
console.log('[DEBUG] MCP ERROR:', err.message);
|
|
175
184
|
return {
|
|
176
185
|
success: false,
|
|
177
186
|
error: `MCP tool error: ${err.message}`
|
|
@@ -180,6 +189,7 @@ async function executeMcpTool(toolName, toolArgs) {
|
|
|
180
189
|
}
|
|
181
190
|
}
|
|
182
191
|
|
|
192
|
+
console.log('[DEBUG] MCP TOOL NOT FOUND:', toolName);
|
|
183
193
|
return {
|
|
184
194
|
success: false,
|
|
185
195
|
error: `MCP tool not found: ${toolName}`
|
|
@@ -435,10 +445,13 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
|
|
|
435
445
|
const mcpTools = getMcpTools();
|
|
436
446
|
const isMcpTool = mcpTools.find(t => t.name === toolCall.name);
|
|
437
447
|
|
|
448
|
+
console.log('[DEBUG] Tool call:', toolCall.name, 'Is MCP?', !!isMcpTool);
|
|
449
|
+
|
|
438
450
|
if (isMcpTool) {
|
|
439
451
|
// Execute MCP tool
|
|
440
452
|
debugLog(`[MCP] Executing tool: ${toolCall.name}`);
|
|
441
453
|
const result = await executeMcpTool(toolCall.name, toolCall.input);
|
|
454
|
+
console.log('[DEBUG] MCP result structure:', { id: toolCall.id, name: toolCall.name, hasSuccess: 'success' in result.result, hasOutput: 'output' in result.result });
|
|
442
455
|
toolResults.push({
|
|
443
456
|
id: toolCall.id,
|
|
444
457
|
name: toolCall.name,
|
|
@@ -448,6 +461,7 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
|
|
|
448
461
|
// Execute local tool
|
|
449
462
|
debugLog(`[Local] Executing tool: ${toolCall.name}`);
|
|
450
463
|
const localResults = await executeToolCalls([toolCall]);
|
|
464
|
+
console.log('[DEBUG] Local result structure:', localResults[0]);
|
|
451
465
|
toolResults.push(...localResults);
|
|
452
466
|
}
|
|
453
467
|
}
|
|
@@ -475,6 +489,9 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
|
|
|
475
489
|
name: result.name,
|
|
476
490
|
content: `[BASE64_ENCODED_RESULT]: ${encoded}`
|
|
477
491
|
});
|
|
492
|
+
|
|
493
|
+
// DEBUG: Check if MCP results are being encoded
|
|
494
|
+
console.log(`[DEBUG] Tool: ${result.name}, Content preview:`, messages[messages.length-1].content.slice(0, 50));
|
|
478
495
|
}
|
|
479
496
|
|
|
480
497
|
// Continue loop to get final response
|