@wisewandtools/mcp-server 2.0.7 → 2.0.9
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 +73 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -288,11 +288,20 @@ var WisewandAPIClient = class {
|
|
|
288
288
|
this.abortController.abort();
|
|
289
289
|
}, this.config.timeout);
|
|
290
290
|
try {
|
|
291
|
-
|
|
291
|
+
const bodyJSON = body ? JSON.stringify(body) : void 0;
|
|
292
|
+
logger.info("API HTTP REQUEST - EXACT JSON", {
|
|
293
|
+
method,
|
|
294
|
+
endpoint,
|
|
295
|
+
url,
|
|
296
|
+
bodyJSON,
|
|
297
|
+
// The EXACT string being sent over HTTP
|
|
298
|
+
body_includes_apply_project_brief_config: bodyJSON?.includes("apply_project_brief_config"),
|
|
299
|
+
body_apply_project_brief_config_value: bodyJSON?.match(/"apply_project_brief_config":(true|false)/)?.[1]
|
|
300
|
+
});
|
|
292
301
|
const response = await fetch(url, {
|
|
293
302
|
method,
|
|
294
303
|
headers: this.headers,
|
|
295
|
-
body:
|
|
304
|
+
body: bodyJSON,
|
|
296
305
|
signal: this.abortController.signal,
|
|
297
306
|
...options
|
|
298
307
|
});
|
|
@@ -495,7 +504,24 @@ var WisewandAPIClient = class {
|
|
|
495
504
|
}
|
|
496
505
|
// ============= Content Discovery =============
|
|
497
506
|
async discoverArticles(input) {
|
|
498
|
-
|
|
507
|
+
logger.info("API Client discoverArticles - INPUT TO API", {
|
|
508
|
+
input_keys: Object.keys(input),
|
|
509
|
+
has_apply_project_brief_config: "apply_project_brief_config" in input,
|
|
510
|
+
apply_project_brief_config_value: input.apply_project_brief_config,
|
|
511
|
+
apply_project_brief_config_type: typeof input.apply_project_brief_config,
|
|
512
|
+
has_project_id: !!input.project_id,
|
|
513
|
+
subject: input.subject,
|
|
514
|
+
endpoint: "/v1/discoverarticles/"
|
|
515
|
+
});
|
|
516
|
+
const requestBody = { ...input };
|
|
517
|
+
if (input.apply_project_brief_config !== void 0) {
|
|
518
|
+
requestBody.apply_project_brief_config = Boolean(input.apply_project_brief_config);
|
|
519
|
+
logger.info("API Client - Explicitly set apply_project_brief_config", {
|
|
520
|
+
original_value: input.apply_project_brief_config,
|
|
521
|
+
explicit_boolean: requestBody.apply_project_brief_config
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
return this.request("POST", "/v1/discoverarticles/", requestBody);
|
|
499
525
|
}
|
|
500
526
|
async getDiscoverArticle(id) {
|
|
501
527
|
return this.request("GET", `/v1/discoverarticles/${id}`);
|
|
@@ -4073,16 +4099,56 @@ var DiscoverToolHandler = class {
|
|
|
4073
4099
|
},
|
|
4074
4100
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4075
4101
|
try {
|
|
4102
|
+
logger.info("discover_content RAW INPUT", {
|
|
4103
|
+
raw_args: args,
|
|
4104
|
+
apply_project_brief_config_raw: args.apply_project_brief_config,
|
|
4105
|
+
apply_project_brief_config_raw_type: typeof args.apply_project_brief_config
|
|
4106
|
+
});
|
|
4076
4107
|
const validated = DiscoverContentSchema.parse(args);
|
|
4077
|
-
logger.
|
|
4108
|
+
logger.info("discover_content VALIDATED (after boolField transform)", {
|
|
4078
4109
|
apply_project_brief_config: validated.apply_project_brief_config,
|
|
4079
4110
|
apply_project_brief_config_type: typeof validated.apply_project_brief_config,
|
|
4080
|
-
has_project_id: !!validated.project_id
|
|
4111
|
+
has_project_id: !!validated.project_id,
|
|
4112
|
+
full_validated: validated
|
|
4081
4113
|
});
|
|
4082
|
-
const
|
|
4114
|
+
const cleanedInput = {};
|
|
4115
|
+
for (const [key, value] of Object.entries(validated)) {
|
|
4116
|
+
if (value !== void 0 && value !== null) {
|
|
4117
|
+
cleanedInput[key] = value;
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
logger.info("discover_content CLEANED INPUT (undefined removed)", {
|
|
4121
|
+
before_cleaning_keys: Object.keys(validated).length,
|
|
4122
|
+
after_cleaning_keys: Object.keys(cleanedInput).length,
|
|
4123
|
+
apply_project_brief_config_included: "apply_project_brief_config" in cleanedInput,
|
|
4124
|
+
apply_project_brief_config_value: cleanedInput.apply_project_brief_config
|
|
4125
|
+
});
|
|
4126
|
+
const discovery = await this.apiClient.discoverArticles(cleanedInput);
|
|
4083
4127
|
await this.cache.set(`discover:${discovery.id}`, discovery, 300);
|
|
4084
4128
|
this.metrics.recordAPICall("discover_content", "success");
|
|
4085
|
-
return {
|
|
4129
|
+
return {
|
|
4130
|
+
content: [{
|
|
4131
|
+
type: "text",
|
|
4132
|
+
text: JSON.stringify({
|
|
4133
|
+
success: true,
|
|
4134
|
+
discovery_id: discovery.id,
|
|
4135
|
+
message: "Content discovery created successfully",
|
|
4136
|
+
// DIAGNOSTIC INFORMATION - shows what MCP received and validated
|
|
4137
|
+
debug_info: {
|
|
4138
|
+
raw_input_has_param: "apply_project_brief_config" in args,
|
|
4139
|
+
raw_input_value: args.apply_project_brief_config,
|
|
4140
|
+
raw_input_type: typeof args.apply_project_brief_config,
|
|
4141
|
+
validated_has_param: "apply_project_brief_config" in validated,
|
|
4142
|
+
validated_value: validated.apply_project_brief_config,
|
|
4143
|
+
validated_type: typeof validated.apply_project_brief_config
|
|
4144
|
+
},
|
|
4145
|
+
next_steps: [
|
|
4146
|
+
`Use 'run_discovery' with id: ${discovery.id}`,
|
|
4147
|
+
`Use 'get_discover_result' with id: ${discovery.id}`
|
|
4148
|
+
]
|
|
4149
|
+
}, null, 2)
|
|
4150
|
+
}]
|
|
4151
|
+
};
|
|
4086
4152
|
} catch (error) {
|
|
4087
4153
|
logger.error("Failed to create discovery", { error: error.message });
|
|
4088
4154
|
this.metrics.recordAPICall("discover_content", "error");
|