@wisewandtools/mcp-server 2.0.17 → 2.0.19

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
@@ -370,10 +370,18 @@ var WisewandAPIClient = class {
370
370
  return this.request("POST", "/v1/articles/cost", input);
371
371
  }
372
372
  async createBulkArticles(articles) {
373
- return this.request("POST", "/v1/articles/bulk", 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
+ });
381
+ return this.request("POST", "/v1/articles/bulk", { articles });
374
382
  }
375
383
  async calculateBulkCost(articles) {
376
- return this.request("POST", "/v1/articles/bulk/cost", articles);
384
+ return this.request("POST", "/v1/articles/bulk/cost", { articles });
377
385
  }
378
386
  // ============= Project Operations =============
379
387
  async createProject(input) {
@@ -1139,7 +1147,7 @@ var CreateArticleSchema = z2.object({
1139
1147
  title: z2.string().optional(),
1140
1148
  keep_title: boolField,
1141
1149
  type: z2.enum(["blog", "affiliation-product-review", "affiliation-compare-products", "affiliation-top-product"]).optional().default("blog"),
1142
- lang: z2.enum(LANG_ENUM).optional().default("en"),
1150
+ lang: z2.enum(LANG_ENUM).optional(),
1143
1151
  country: z2.enum(COUNTRY_ENUM).optional(),
1144
1152
  length: z2.union([z2.number().max(5e3), z2.literal("auto")]).optional().default("auto"),
1145
1153
  target_keyword: z2.string().optional(),
@@ -2760,6 +2768,14 @@ var BulkOperationsToolHandler = class {
2760
2768
  handler: /* @__PURE__ */ __name(async (args) => {
2761
2769
  try {
2762
2770
  const { articles, auto_generate = false } = args;
2771
+ logger.info("BULK CREATE DEBUG - Handler received:", {
2772
+ articles_type: typeof articles,
2773
+ is_array: Array.isArray(articles),
2774
+ articles_length: Array.isArray(articles) ? articles.length : "N/A",
2775
+ articles_stringified: typeof articles === "string",
2776
+ first_article: Array.isArray(articles) && articles.length > 0 ? articles[0] : null,
2777
+ auto_generate
2778
+ });
2763
2779
  logger.info("Starting bulk article creation", { count: articles.length });
2764
2780
  const createResult = await this.apiClient.createBulkArticles(articles);
2765
2781
  const results = {
@@ -3460,6 +3476,15 @@ var CategoryPagesToolHandler = class {
3460
3476
  static {
3461
3477
  __name(this, "CategoryPagesToolHandler");
3462
3478
  }
3479
+ buildApiInput(validated) {
3480
+ const input = {};
3481
+ Object.keys(validated).forEach((key) => {
3482
+ if (validated[key] !== void 0 && validated[key] !== null) {
3483
+ input[key] = validated[key];
3484
+ }
3485
+ });
3486
+ return input;
3487
+ }
3463
3488
  getTools() {
3464
3489
  return [
3465
3490
  this.createCategoryPageTool(),
@@ -3508,11 +3533,13 @@ var CategoryPagesToolHandler = class {
3508
3533
  handler: /* @__PURE__ */ __name(async (args) => {
3509
3534
  try {
3510
3535
  const validated = CreateCategoryPageSchema.parse(args);
3511
- const categoryPage = await this.apiClient.createCategoryPage(validated);
3536
+ const input = this.buildApiInput(validated);
3537
+ const categoryPage = await this.apiClient.createCategoryPage(input);
3512
3538
  await this.cache.set(`category_page:${categoryPage.id}`, categoryPage, 300);
3513
3539
  this.metrics.recordAPICall("create_category_page", "success");
3540
+ const displayName = categoryPage.name || validated.name || args.name || "Unnamed";
3514
3541
  return {
3515
- content: [{ type: "text", text: JSON.stringify({ success: true, category_page_id: categoryPage.id, name: categoryPage.name || validated.name, message: `Category page "${categoryPage.name || validated.name}" created successfully`, next_steps: [`Use 'generate_category_page' with id: ${categoryPage.id}`, `Use 'get_category_page' with id: ${categoryPage.id}`] }, null, 2) }]
3542
+ content: [{ type: "text", text: JSON.stringify({ success: true, category_page_id: categoryPage.id, name: displayName, message: `Category page "${displayName}" created successfully`, next_steps: [`Use 'generate_category_page' with id: ${categoryPage.id}`, `Use 'get_category_page' with id: ${categoryPage.id}`] }, null, 2) }]
3516
3543
  };
3517
3544
  } catch (error) {
3518
3545
  logger.error("Failed to create category page", { error: error.message });
@@ -3761,6 +3788,15 @@ var ProductPagesToolHandler = class {
3761
3788
  static {
3762
3789
  __name(this, "ProductPagesToolHandler");
3763
3790
  }
3791
+ buildApiInput(validated) {
3792
+ const input = {};
3793
+ Object.keys(validated).forEach((key) => {
3794
+ if (validated[key] !== void 0 && validated[key] !== null) {
3795
+ input[key] = validated[key];
3796
+ }
3797
+ });
3798
+ return input;
3799
+ }
3764
3800
  getTools() {
3765
3801
  return [
3766
3802
  this.createProductPageTool(),
@@ -3811,10 +3847,12 @@ var ProductPagesToolHandler = class {
3811
3847
  handler: /* @__PURE__ */ __name(async (args) => {
3812
3848
  try {
3813
3849
  const validated = CreateProductPageSchema.parse(args);
3814
- const productPage = await this.apiClient.createProductPage(validated);
3850
+ const input = this.buildApiInput(validated);
3851
+ const productPage = await this.apiClient.createProductPage(input);
3815
3852
  await this.cache.set(`product_page:${productPage.id}`, productPage, 300);
3816
3853
  this.metrics.recordAPICall("create_product_page", "success");
3817
- return { content: [{ type: "text", text: JSON.stringify({ success: true, product_page_id: productPage.id, name: productPage.name || validated.name, message: `Product page "${productPage.name || validated.name}" created successfully`, next_steps: [`Use 'generate_product_page' with id: ${productPage.id}`, `Use 'get_product_page' with id: ${productPage.id}`] }, null, 2) }] };
3854
+ const displayName = productPage.name || validated.name || args.name || "Unnamed";
3855
+ return { content: [{ type: "text", text: JSON.stringify({ success: true, product_page_id: productPage.id, name: displayName, message: `Product page "${displayName}" created successfully`, next_steps: [`Use 'generate_product_page' with id: ${productPage.id}`, `Use 'get_product_page' with id: ${productPage.id}`] }, null, 2) }] };
3818
3856
  } catch (error) {
3819
3857
  logger.error("Failed to create product page", { error: error.message });
3820
3858
  this.metrics.recordAPICall("create_product_page", "error");