neuro-vault-mcp 3.3.0 → 3.3.1
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/cli.js +23 -15
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14275,7 +14275,7 @@ function unwrap(schema) {
|
|
|
14275
14275
|
function isPlainObject2(value) {
|
|
14276
14276
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14277
14277
|
}
|
|
14278
|
-
function
|
|
14278
|
+
function coerceFieldValue(schema, value) {
|
|
14279
14279
|
if (value === null || value === void 0) return value;
|
|
14280
14280
|
const inner = unwrap(schema);
|
|
14281
14281
|
if (inner instanceof external_exports.ZodNumber) {
|
|
@@ -14303,18 +14303,26 @@ function coerceField(schema, value) {
|
|
|
14303
14303
|
}
|
|
14304
14304
|
return value;
|
|
14305
14305
|
}
|
|
14306
|
-
function
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
out[key] = coerceField(shape[key], out[key]);
|
|
14315
|
-
}
|
|
14306
|
+
function wrapField(field) {
|
|
14307
|
+
let inner = field;
|
|
14308
|
+
let isOptional = false;
|
|
14309
|
+
while (inner instanceof external_exports.ZodOptional || inner instanceof external_exports.ZodNullable || inner instanceof external_exports.ZodDefault) {
|
|
14310
|
+
if (inner instanceof external_exports.ZodOptional) isOptional = true;
|
|
14311
|
+
const next = inner.unwrap();
|
|
14312
|
+
if (!next) break;
|
|
14313
|
+
inner = next;
|
|
14316
14314
|
}
|
|
14317
|
-
|
|
14315
|
+
const wrapped = external_exports.preprocess((v) => coerceFieldValue(inner, v), inner);
|
|
14316
|
+
return isOptional ? wrapped.optional() : wrapped;
|
|
14317
|
+
}
|
|
14318
|
+
function wrapSchemaWithCoercion(schema) {
|
|
14319
|
+
if (!(schema instanceof external_exports.ZodObject)) return schema;
|
|
14320
|
+
const shape = schema.shape;
|
|
14321
|
+
const newShape = {};
|
|
14322
|
+
for (const [key, field] of Object.entries(shape)) {
|
|
14323
|
+
newShape[key] = wrapField(field);
|
|
14324
|
+
}
|
|
14325
|
+
return external_exports.object(newShape);
|
|
14318
14326
|
}
|
|
14319
14327
|
|
|
14320
14328
|
// src/lib/tool-response.ts
|
|
@@ -14385,18 +14393,18 @@ function formatZodError(error48) {
|
|
|
14385
14393
|
return { message, issues };
|
|
14386
14394
|
}
|
|
14387
14395
|
function registerTool(tool) {
|
|
14396
|
+
const coercingSchema = wrapSchemaWithCoercion(tool.inputSchema);
|
|
14388
14397
|
return {
|
|
14389
14398
|
name: tool.name,
|
|
14390
14399
|
spec: {
|
|
14391
14400
|
...tool.title !== void 0 ? { title: tool.title } : {},
|
|
14392
14401
|
description: tool.description,
|
|
14393
|
-
inputSchema:
|
|
14402
|
+
inputSchema: coercingSchema,
|
|
14394
14403
|
...tool.outputSchema !== void 0 ? { outputSchema: tool.outputSchema } : {},
|
|
14395
14404
|
...tool.annotations !== void 0 ? { annotations: tool.annotations } : {}
|
|
14396
14405
|
},
|
|
14397
14406
|
handler: async (args) => invokeTool(async () => {
|
|
14398
|
-
const
|
|
14399
|
-
const result = tool.inputSchema.safeParse(coerced);
|
|
14407
|
+
const result = coercingSchema.safeParse(args);
|
|
14400
14408
|
if (!result.success) {
|
|
14401
14409
|
const { message, issues } = formatZodError(result.error);
|
|
14402
14410
|
throw new ToolHandlerError("INVALID_PARAMS", message, { details: { issues } });
|