natureco-cli 2.11.1 → 2.11.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "2.11.1",
3
+ "version": "2.11.3",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "main": "bin/natureco.js",
6
6
  "bin": {
@@ -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.11.1</div>
214
+ <div class="version-badge" id="version-badge">v2.11.3</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.11.1',
344
+ version: 'v2.11.3',
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.11.1...', 'green');
141
+ log('gateway', 'Starting NatureCo Gateway v2.11.3...', 'green');
142
142
 
143
143
  // Load config
144
144
  const { getConfig } = require('../utils/config');
package/src/utils/api.js CHANGED
@@ -140,31 +140,39 @@ function getMcpTools() {
140
140
  * Coerce MCP tool parameters to match schema types
141
141
  */
142
142
  function coerceMcpParams(tool, params) {
143
- const schema = tool.inputSchema?.properties || tool.input_schema?.properties || {};
143
+ // GitHub MCP uses inputSchema, others may use input_schema
144
+ // Try all possible schema locations
145
+ const schema = tool.inputSchema?.properties ||
146
+ tool.input_schema?.properties ||
147
+ tool.parameters?.properties || // fallback
148
+ {};
149
+
150
+ // Debug: Show which schema format was found
151
+ console.log('[DEBUG] COERCE TOOL:', tool.name);
152
+ console.log('[DEBUG] COERCE SCHEMA SOURCE:',
153
+ tool.inputSchema?.properties ? 'inputSchema.properties' :
154
+ tool.input_schema?.properties ? 'input_schema.properties' :
155
+ tool.parameters?.properties ? 'parameters.properties' : 'NONE');
156
+ console.log('[DEBUG] COERCE SCHEMA:', JSON.stringify(schema).slice(0, 200));
157
+
144
158
  const coerced = { ...params };
145
159
 
146
160
  for (const [key, def] of Object.entries(schema)) {
147
161
  if (coerced[key] === undefined || coerced[key] === null) continue;
148
162
 
149
- // Coerce number
150
- if (def.type === 'number' && typeof coerced[key] === 'string') {
163
+ // Coerce number or integer
164
+ if ((def.type === 'number' || def.type === 'integer') && typeof coerced[key] === 'string') {
151
165
  const num = Number(coerced[key]);
152
166
  if (!isNaN(num)) {
153
167
  coerced[key] = num;
168
+ console.log('[DEBUG] COERCED', key, 'from string to number:', coerced[key]);
154
169
  }
155
170
  }
156
171
 
157
172
  // Coerce boolean
158
173
  if (def.type === 'boolean' && typeof coerced[key] === 'string') {
159
174
  coerced[key] = coerced[key] === 'true' || coerced[key] === '1';
160
- }
161
-
162
- // Coerce integer
163
- if (def.type === 'integer' && typeof coerced[key] === 'string') {
164
- const num = parseInt(coerced[key], 10);
165
- if (!isNaN(num)) {
166
- coerced[key] = num;
167
- }
175
+ console.log('[DEBUG] COERCED', key, 'from string to boolean:', coerced[key]);
168
176
  }
169
177
  }
170
178
 
@@ -201,7 +209,14 @@ async function executeMcpTool(toolName, toolArgs) {
201
209
  .map(c => c.text);
202
210
 
203
211
  if (textContents.length > 0) {
204
- const output = textContents.join('\n');
212
+ let output = textContents.join('\n');
213
+
214
+ // Truncate MCP result to max 1500 characters
215
+ if (output.length > 1500) {
216
+ output = output.slice(0, 1500) + '... (truncated)';
217
+ console.log('[DEBUG] MCP OUTPUT TRUNCATED from', textContents.join('\n').length, 'to 1500 chars');
218
+ }
219
+
205
220
  console.log('[DEBUG] MCP FORMATTED OUTPUT:', output.slice(0, 100));
206
221
  return {
207
222
  success: true,
@@ -211,7 +226,14 @@ async function executeMcpTool(toolName, toolArgs) {
211
226
  }
212
227
 
213
228
  // Fallback: return entire result as JSON
214
- const fallbackOutput = JSON.stringify(result, null, 2);
229
+ let fallbackOutput = JSON.stringify(result, null, 2);
230
+
231
+ // Truncate fallback output too
232
+ if (fallbackOutput.length > 1500) {
233
+ fallbackOutput = fallbackOutput.slice(0, 1500) + '... (truncated)';
234
+ console.log('[DEBUG] MCP FALLBACK OUTPUT TRUNCATED');
235
+ }
236
+
215
237
  console.log('[DEBUG] MCP FALLBACK OUTPUT:', fallbackOutput.slice(0, 100));
216
238
  return {
217
239
  success: true,