@wisewandtools/mcp-server 2.2.3 → 2.2.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/dist/index.js +27 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2397,8 +2397,19 @@ var PublishingToolHandler = class {
|
|
|
2397
2397
|
if (storedAuthor && !author_id) {
|
|
2398
2398
|
if (clear_author) {
|
|
2399
2399
|
try {
|
|
2400
|
-
await this.apiClient.updateArticle(entity_id, { publishwordpress_author:
|
|
2401
|
-
|
|
2400
|
+
await this.apiClient.updateArticle(entity_id, { publishwordpress_author: null });
|
|
2401
|
+
try {
|
|
2402
|
+
const updated = await this.apiClient.getArticle(entity_id);
|
|
2403
|
+
const stillPresent = updated.data?.input?.publishwordpress_author;
|
|
2404
|
+
if (stillPresent) {
|
|
2405
|
+
logger.warn("publishwordpress_author still present after clear attempt", { entity_id, value: stillPresent });
|
|
2406
|
+
warnings.push(`publishwordpress_author may not have been fully cleared (still shows "${stillPresent}"). Publishing may still fail.`);
|
|
2407
|
+
} else {
|
|
2408
|
+
logger.info("Cleared stored publishwordpress_author before publishing", { entity_id, cleared_author: storedAuthor });
|
|
2409
|
+
}
|
|
2410
|
+
} catch (verifyError) {
|
|
2411
|
+
logger.warn("Could not verify publishwordpress_author was cleared", { error: verifyError.message });
|
|
2412
|
+
}
|
|
2402
2413
|
} catch (clearError) {
|
|
2403
2414
|
logger.warn("Failed to clear publishwordpress_author", { error: clearError.message });
|
|
2404
2415
|
warnings.push(`Could not clear stored publishwordpress_author (${storedAuthor}). Publishing may fail if the WP connection user lacks edit_others_posts.`);
|
|
@@ -3126,20 +3137,19 @@ var BulkOperationsToolHandler = class {
|
|
|
3126
3137
|
const result2 = await this.apiClient.calculateBulkCost(articles);
|
|
3127
3138
|
logger.debug("bulk_estimate_cost raw API response keys", { keys: Object.keys(result2 || {}) });
|
|
3128
3139
|
const breakdown = result2?.breakdown ?? result2?.items ?? result2?.estimates ?? [];
|
|
3129
|
-
let
|
|
3130
|
-
if (typeof result2?.
|
|
3131
|
-
|
|
3132
|
-
} else if (typeof result2?.
|
|
3133
|
-
|
|
3134
|
-
} else if (typeof result2?.cost === "number" && !isNaN(result2.cost)) {
|
|
3135
|
-
total = result2.cost;
|
|
3140
|
+
let totalCredits;
|
|
3141
|
+
if (typeof result2?.credits === "number" && !isNaN(result2.credits)) {
|
|
3142
|
+
totalCredits = result2.credits;
|
|
3143
|
+
} else if (typeof result2?.total === "number" && !isNaN(result2.total)) {
|
|
3144
|
+
totalCredits = result2.total;
|
|
3136
3145
|
} else if (Array.isArray(breakdown) && breakdown.length > 0) {
|
|
3137
|
-
|
|
3138
|
-
logger.info("bulk_estimate_cost:
|
|
3146
|
+
totalCredits = breakdown.reduce((sum, item) => sum + (item?.credits ?? item?.cost ?? 0), 0);
|
|
3147
|
+
logger.info("bulk_estimate_cost: totalCredits derived from breakdown sum", { totalCredits });
|
|
3139
3148
|
} else {
|
|
3140
|
-
|
|
3141
|
-
logger.warn("bulk_estimate_cost: could not extract
|
|
3149
|
+
totalCredits = 0;
|
|
3150
|
+
logger.warn("bulk_estimate_cost: could not extract credits from API response, defaulting to 0", { resultKeys: Object.keys(result2 || {}) });
|
|
3142
3151
|
}
|
|
3152
|
+
const totalCost = typeof result2?.cost === "number" && !isNaN(result2.cost) ? result2.cost : typeof result2?.price === "number" && !isNaN(result2.price) ? result2.price : null;
|
|
3143
3153
|
this.metrics.recordAPICall("bulk_estimate_cost", "success");
|
|
3144
3154
|
return {
|
|
3145
3155
|
content: [
|
|
@@ -3148,13 +3158,13 @@ var BulkOperationsToolHandler = class {
|
|
|
3148
3158
|
text: JSON.stringify({
|
|
3149
3159
|
success: true,
|
|
3150
3160
|
total_cost: {
|
|
3151
|
-
credits:
|
|
3152
|
-
usd:
|
|
3161
|
+
credits: totalCredits,
|
|
3162
|
+
usd: totalCost !== null ? totalCost.toFixed(2) : null
|
|
3153
3163
|
},
|
|
3154
3164
|
article_count: articles.length,
|
|
3155
3165
|
average_cost_per_article: {
|
|
3156
|
-
credits: articles.length > 0 ? Math.round(
|
|
3157
|
-
usd: articles.length > 0 ? (
|
|
3166
|
+
credits: articles.length > 0 ? Math.round(totalCredits / articles.length) : 0,
|
|
3167
|
+
usd: totalCost !== null && articles.length > 0 ? (totalCost / articles.length).toFixed(2) : null
|
|
3158
3168
|
},
|
|
3159
3169
|
breakdown
|
|
3160
3170
|
}, null, 2)
|