@wisewandtools/mcp-server 2.1.0 → 2.1.2

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 CHANGED
@@ -374,14 +374,17 @@ var WisewandAPIClient = class {
374
374
  articles_type: typeof articles,
375
375
  is_array: Array.isArray(articles),
376
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)
377
+ format: "raw_array",
378
+ first_article: articles.length > 0 ? articles[0] : null
380
379
  });
381
- return this.request("POST", "/v1/articles/bulk", { articles });
380
+ const response = await this.request("POST", "/v1/articles/bulk", articles);
381
+ return {
382
+ items: response.ids.map((id) => ({ id })),
383
+ errors: []
384
+ };
382
385
  }
383
386
  async calculateBulkCost(articles) {
384
- return this.request("POST", "/v1/articles/bulk/cost", { articles });
387
+ return this.request("POST", "/v1/articles/bulk/cost", articles);
385
388
  }
386
389
  // ============= Project Operations =============
387
390
  async createProject(input) {
@@ -476,7 +479,7 @@ var WisewandAPIClient = class {
476
479
  return this.request("POST", "/v1/categorypages/cost", input);
477
480
  }
478
481
  async createBulkCategoryPages(items) {
479
- return this.request("POST", "/v1/categorypages/bulk", { items });
482
+ return this.request("POST", "/v1/categorypages/bulk", items);
480
483
  }
481
484
  // ============= Product Pages =============
482
485
  async createProductPage(input) {
@@ -502,7 +505,7 @@ var WisewandAPIClient = class {
502
505
  return this.request("POST", "/v1/productpages/cost", input);
503
506
  }
504
507
  async createBulkProductPages(items) {
505
- return this.request("POST", "/v1/productpages/bulk", { items });
508
+ return this.request("POST", "/v1/productpages/bulk", items);
506
509
  }
507
510
  // ============= Content Discovery =============
508
511
  async discoverArticles(input) {
@@ -528,7 +531,7 @@ var WisewandAPIClient = class {
528
531
  return this.request("POST", "/v1/discoverarticles/cost", input);
529
532
  }
530
533
  async createBulkDiscoverArticles(items) {
531
- return this.request("POST", "/v1/discoverarticles/bulk", { items });
534
+ return this.request("POST", "/v1/discoverarticles/bulk", items);
532
535
  }
533
536
  // ============= Feeds (was RSS Feed Triggers) =============
534
537
  async createFeed(input) {
@@ -2777,15 +2780,27 @@ var BulkOperationsToolHandler = class {
2777
2780
  }
2778
2781
  }
2779
2782
  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,
2783
+ logger.info("Validating and transforming article data types", { count: articles.length });
2784
+ const validatedArticles = articles.map((article, index) => {
2785
+ try {
2786
+ const validated = CreateArticleSchema.parse(article);
2787
+ return validated;
2788
+ } catch (error) {
2789
+ logger.error(`Validation failed for article ${index}:`, {
2790
+ article,
2791
+ error: error.message
2792
+ });
2793
+ throw new Error(`Article ${index} validation failed: ${error.message}`);
2794
+ }
2795
+ });
2796
+ logger.info("BULK CREATE DEBUG - After validation:", {
2797
+ original_count: articles.length,
2798
+ validated_count: validatedArticles.length,
2799
+ first_validated: validatedArticles.length > 0 ? validatedArticles[0] : null,
2785
2800
  auto_generate
2786
2801
  });
2787
- logger.info("Starting bulk article creation", { count: articles.length });
2788
- const createResult = await this.apiClient.createBulkArticles(articles);
2802
+ logger.info("Starting bulk article creation", { count: validatedArticles.length });
2803
+ const createResult = await this.apiClient.createBulkArticles(validatedArticles);
2789
2804
  const results = {
2790
2805
  total: articles.length,
2791
2806
  created: createResult.items.length,