brilliant-directories-mcp 6.45.0 → 6.45.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/index.js +43 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -403,7 +403,12 @@ function buildTools(spec) {
|
|
|
403
403
|
const schema = content?.["application/x-www-form-urlencoded"]?.schema;
|
|
404
404
|
if (schema && schema.properties) {
|
|
405
405
|
for (const [key, val] of Object.entries(schema.properties)) {
|
|
406
|
-
|
|
406
|
+
// Resolve $ref so agent-facing schema sees the actual type (e.g.
|
|
407
|
+
// `_ClearFields` resolves to {type: "array", items: ...}). Without
|
|
408
|
+
// this, MCP clients see {$ref: "..."} and treat the input as opaque
|
|
409
|
+
// string — Array.isArray fails downstream and guards skip.
|
|
410
|
+
const resolved = val && val.$ref ? resolveRef(spec, val.$ref) : val;
|
|
411
|
+
properties[key] = { ...resolved };
|
|
407
412
|
}
|
|
408
413
|
if (schema.required) {
|
|
409
414
|
for (const r of schema.required) {
|
|
@@ -3693,8 +3698,14 @@ function makeRequest(config, method, urlPath, queryParams, bodyParams, clearFiel
|
|
|
3693
3698
|
// Agent passes `_clear_fields: [...]` (single underscore, array).
|
|
3694
3699
|
// Wrapper translates to BD's native wire parameter
|
|
3695
3700
|
// `__clear_fields=col1,col2` (DOUBLE underscore, CSV). BD's update
|
|
3696
|
-
// controller
|
|
3697
|
-
|
|
3701
|
+
// controller checks `isset($arguments[$column]) && ($value !== "" || in_array($column, $clearFields))`.
|
|
3702
|
+
// We must emit BOTH (a) `field=` per clear-target so isset() is true,
|
|
3703
|
+
// AND (b) `__clear_fields=csv` so BD knows the empty is intentional.
|
|
3704
|
+
// Without (a), BD's foreach loop skips the column entirely. CEO-directive shape.
|
|
3705
|
+
if (hasClear) {
|
|
3706
|
+
for (const name of clearFields) params.append(name, "");
|
|
3707
|
+
params.append("__clear_fields", clearFields.join(","));
|
|
3708
|
+
}
|
|
3698
3709
|
bodyStr = params.toString();
|
|
3699
3710
|
}
|
|
3700
3711
|
|
|
@@ -4545,15 +4556,38 @@ async function main() {
|
|
|
4545
4556
|
}
|
|
4546
4557
|
|
|
4547
4558
|
// Peel off the wrapper-only `_clear_fields` array before any distribution
|
|
4548
|
-
// loop runs — it's not a BD-API param, it's a directive to makeRequest
|
|
4549
|
-
//
|
|
4550
|
-
//
|
|
4559
|
+
// loop runs — it's not a BD-API param, it's a directive to makeRequest.
|
|
4560
|
+
// ALWAYS strip the key first (even if malformed), THEN parse. Without
|
|
4561
|
+
// unconditional strip, a non-array `_clear_fields` would leak into the
|
|
4562
|
+
// body dispatch, be sent as a regular form param, and BD would route the
|
|
4563
|
+
// unknown column name to users_meta as a spurious EAV row — the exact
|
|
4564
|
+
// pollution we shipped v6.45.1 to fix. See **Rule: Clearing fields**.
|
|
4551
4565
|
let clearFields;
|
|
4552
|
-
|
|
4553
|
-
|
|
4566
|
+
let rawClear;
|
|
4567
|
+
if (args && Object.prototype.hasOwnProperty.call(args, "_clear_fields")) {
|
|
4568
|
+
rawClear = args._clear_fields;
|
|
4569
|
+
delete args._clear_fields;
|
|
4570
|
+
}
|
|
4571
|
+
if (Array.isArray(rawClear)) {
|
|
4572
|
+
clearFields = rawClear
|
|
4554
4573
|
.filter((n) => typeof n === "string" && n.trim().length > 0)
|
|
4555
4574
|
.map((n) => n.trim());
|
|
4556
|
-
|
|
4575
|
+
} else if (typeof rawClear === "string" && rawClear.trim().length > 0) {
|
|
4576
|
+
// Tolerate JSON-stringified array (some MCP clients serialize array
|
|
4577
|
+
// inputs as strings when the schema isn't fully resolved). Parse then
|
|
4578
|
+
// fall through; if it's CSV, that's also supported.
|
|
4579
|
+
const s = rawClear.trim();
|
|
4580
|
+
let parsed;
|
|
4581
|
+
try { parsed = JSON.parse(s); } catch { parsed = null; }
|
|
4582
|
+
if (Array.isArray(parsed)) {
|
|
4583
|
+
clearFields = parsed
|
|
4584
|
+
.filter((n) => typeof n === "string" && n.trim().length > 0)
|
|
4585
|
+
.map((n) => n.trim());
|
|
4586
|
+
} else {
|
|
4587
|
+
clearFields = s.split(",")
|
|
4588
|
+
.map((n) => n.trim())
|
|
4589
|
+
.filter((n) => n.length > 0);
|
|
4590
|
+
}
|
|
4557
4591
|
}
|
|
4558
4592
|
// Two guards on _clear_fields. (BD v6.45.0+ natively handles clears on
|
|
4559
4593
|
// base AND EAV-routed fields via __clear_fields=csv on the wire; EAV
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brilliant-directories-mcp",
|
|
3
3
|
"mcpName": "io.github.brilliantdirectories/brilliant-directories-mcp",
|
|
4
|
-
"version": "6.45.
|
|
4
|
+
"version": "6.45.2",
|
|
5
5
|
"description": "Official MCP server for Brilliant Directories — manage members, posts, leads, reviews, and more.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"bin": {
|