natureco-cli 2.11.3 → 2.11.4
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 +38 -4
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.11.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.11.4</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.
|
|
344
|
+
version: 'v2.11.4',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/utils/api.js
CHANGED
|
@@ -136,6 +136,30 @@ function getMcpTools() {
|
|
|
136
136
|
return allTools;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Normalize MCP tool schema for AI consumption
|
|
141
|
+
* Adds hints to number/integer parameters to prevent string conversion
|
|
142
|
+
*/
|
|
143
|
+
function normalizeMcpToolSchema(tool) {
|
|
144
|
+
const schema = tool.inputSchema || tool.input_schema || {};
|
|
145
|
+
|
|
146
|
+
// Ensure properties exist
|
|
147
|
+
if (!schema.properties) return tool;
|
|
148
|
+
|
|
149
|
+
// Clone schema to avoid mutating original
|
|
150
|
+
const normalizedSchema = JSON.parse(JSON.stringify(schema));
|
|
151
|
+
|
|
152
|
+
// Groq sometimes sends strings for number params
|
|
153
|
+
// Add coercion hint to description
|
|
154
|
+
for (const [key, prop] of Object.entries(normalizedSchema.properties)) {
|
|
155
|
+
if (prop.type === 'number' || prop.type === 'integer') {
|
|
156
|
+
prop.description = (prop.description || '') + ' (must be a number, not a string)';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return { ...tool, inputSchema: normalizedSchema };
|
|
161
|
+
}
|
|
162
|
+
|
|
139
163
|
/**
|
|
140
164
|
* Coerce MCP tool parameters to match schema types
|
|
141
165
|
*/
|
|
@@ -336,8 +360,11 @@ function formatToolsForOpenAI() {
|
|
|
336
360
|
const localTools = getToolDefinitions();
|
|
337
361
|
const mcpTools = getMcpTools();
|
|
338
362
|
|
|
339
|
-
//
|
|
340
|
-
const
|
|
363
|
+
// Normalize MCP tools before combining
|
|
364
|
+
const normalizedMcpTools = mcpTools.map(tool => normalizeMcpToolSchema(tool));
|
|
365
|
+
|
|
366
|
+
// Combine local and normalized MCP tools
|
|
367
|
+
const allTools = [...localTools, ...normalizedMcpTools];
|
|
341
368
|
|
|
342
369
|
return allTools.map(tool => ({
|
|
343
370
|
type: 'function',
|
|
@@ -356,8 +383,11 @@ function formatToolsForAnthropic() {
|
|
|
356
383
|
const localTools = getToolDefinitions();
|
|
357
384
|
const mcpTools = getMcpTools();
|
|
358
385
|
|
|
359
|
-
//
|
|
360
|
-
const
|
|
386
|
+
// Normalize MCP tools before combining
|
|
387
|
+
const normalizedMcpTools = mcpTools.map(tool => normalizeMcpToolSchema(tool));
|
|
388
|
+
|
|
389
|
+
// Combine local and normalized MCP tools
|
|
390
|
+
const allTools = [...localTools, ...normalizedMcpTools];
|
|
361
391
|
|
|
362
392
|
return allTools.map(tool => ({
|
|
363
393
|
name: tool.name,
|
|
@@ -663,6 +693,10 @@ ENCODING: Tool results are base64 encoded with prefix [BASE64_ENCODED_RESULT]:.
|
|
|
663
693
|
NEVER show the base64 string to the user. Decode it internally and present the data in a human-readable format.
|
|
664
694
|
The encoding is for security - you must decode and interpret the results before responding.
|
|
665
695
|
|
|
696
|
+
CRITICAL: For MCP tools, ALWAYS send number/integer parameters as numbers (not strings).
|
|
697
|
+
Example: per_page must be 3 (not "3"), issue_number must be 5 (not "5"), limit must be 10 (not "10").
|
|
698
|
+
When you see a parameter with type "number" or "integer", convert string values to actual numbers before calling the tool.
|
|
699
|
+
|
|
666
700
|
TOOL SELECTION GUIDE:
|
|
667
701
|
- read_file: Use for .txt, .md, .json, .log, .csv files
|
|
668
702
|
- bash with "cat file | head -100": Use for .sh, .py, .js, .ts, .env, config files, or any file with special characters
|