@wisewandtools/mcp-server 2.0.18 → 2.1.0
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/dist/index.js +36 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -370,6 +370,14 @@ var WisewandAPIClient = class {
|
|
|
370
370
|
return this.request("POST", "/v1/articles/cost", input);
|
|
371
371
|
}
|
|
372
372
|
async createBulkArticles(articles) {
|
|
373
|
+
logger.info("BULK CREATE DEBUG - API Client sending:", {
|
|
374
|
+
articles_type: typeof articles,
|
|
375
|
+
is_array: Array.isArray(articles),
|
|
376
|
+
articles_length: Array.isArray(articles) ? articles.length : "N/A",
|
|
377
|
+
wrapped_format: { articles },
|
|
378
|
+
wrapped_type: typeof { articles },
|
|
379
|
+
wrapped_stringified: JSON.stringify({ articles }).substring(0, 200)
|
|
380
|
+
});
|
|
373
381
|
return this.request("POST", "/v1/articles/bulk", { articles });
|
|
374
382
|
}
|
|
375
383
|
async calculateBulkCost(articles) {
|
|
@@ -1764,7 +1772,7 @@ var ArticleToolHandler = class {
|
|
|
1764
1772
|
try {
|
|
1765
1773
|
const cost = await this.apiClient.calculateArticleCost(args);
|
|
1766
1774
|
this.metrics.recordAPICall("estimate_cost", "success");
|
|
1767
|
-
return { content: [{ type: "text", text: JSON.stringify({ success: true, cost_estimate: cost, message: `Estimated cost: ${cost.credits} credits ($${cost.
|
|
1775
|
+
return { content: [{ type: "text", text: JSON.stringify({ success: true, cost_estimate: cost, message: `Estimated cost: ${cost.credits} credits ($${cost.cost})` }, null, 2) }] };
|
|
1768
1776
|
} catch (error) {
|
|
1769
1777
|
logger.error("Failed to estimate cost", { error: error.message });
|
|
1770
1778
|
this.metrics.recordAPICall("estimate_cost", "error");
|
|
@@ -2759,7 +2767,23 @@ var BulkOperationsToolHandler = class {
|
|
|
2759
2767
|
},
|
|
2760
2768
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
2761
2769
|
try {
|
|
2762
|
-
|
|
2770
|
+
let processedArgs = { ...args };
|
|
2771
|
+
if (typeof args.articles === "string") {
|
|
2772
|
+
logger.info("Converting articles from string to array");
|
|
2773
|
+
try {
|
|
2774
|
+
processedArgs.articles = JSON.parse(args.articles);
|
|
2775
|
+
} catch (error) {
|
|
2776
|
+
throw new Error("Invalid articles format: expected array or JSON string");
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
const { articles, auto_generate = false } = processedArgs;
|
|
2780
|
+
logger.info("BULK CREATE DEBUG - Handler received:", {
|
|
2781
|
+
articles_type: typeof articles,
|
|
2782
|
+
is_array: Array.isArray(articles),
|
|
2783
|
+
articles_length: Array.isArray(articles) ? articles.length : "N/A",
|
|
2784
|
+
first_article: Array.isArray(articles) && articles.length > 0 ? articles[0] : null,
|
|
2785
|
+
auto_generate
|
|
2786
|
+
});
|
|
2763
2787
|
logger.info("Starting bulk article creation", { count: articles.length });
|
|
2764
2788
|
const createResult = await this.apiClient.createBulkArticles(articles);
|
|
2765
2789
|
const results = {
|
|
@@ -2854,7 +2878,16 @@ var BulkOperationsToolHandler = class {
|
|
|
2854
2878
|
},
|
|
2855
2879
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
2856
2880
|
try {
|
|
2857
|
-
|
|
2881
|
+
let processedArgs = { ...args };
|
|
2882
|
+
if (typeof args.articles === "string") {
|
|
2883
|
+
logger.info("Converting articles from string to array (bulk cost estimate)");
|
|
2884
|
+
try {
|
|
2885
|
+
processedArgs.articles = JSON.parse(args.articles);
|
|
2886
|
+
} catch (error) {
|
|
2887
|
+
throw new Error("Invalid articles format: expected array or JSON string");
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
const { articles } = processedArgs;
|
|
2858
2891
|
const result2 = await this.apiClient.calculateBulkCost(articles);
|
|
2859
2892
|
this.metrics.recordAPICall("bulk_estimate_cost", "success");
|
|
2860
2893
|
return {
|