@kadoa/mcp 0.3.5-rc.2 → 0.3.5-rc.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 +26 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49167,6 +49167,20 @@ var init_client2 = __esm(() => {
|
|
|
49167
49167
|
});
|
|
49168
49168
|
|
|
49169
49169
|
// src/tools.ts
|
|
49170
|
+
function coerceArray(wrapPlainString = false) {
|
|
49171
|
+
return (val) => {
|
|
49172
|
+
if (typeof val === "string") {
|
|
49173
|
+
try {
|
|
49174
|
+
const parsed = JSON.parse(val);
|
|
49175
|
+
if (Array.isArray(parsed))
|
|
49176
|
+
return parsed;
|
|
49177
|
+
} catch {}
|
|
49178
|
+
if (wrapPlainString)
|
|
49179
|
+
return [val];
|
|
49180
|
+
}
|
|
49181
|
+
return val;
|
|
49182
|
+
};
|
|
49183
|
+
}
|
|
49170
49184
|
function isRealTimeInterval(interval) {
|
|
49171
49185
|
return interval?.toUpperCase().replace("-", "_") === "REAL_TIME";
|
|
49172
49186
|
}
|
|
@@ -49287,10 +49301,11 @@ function registerTools(server, ctx) {
|
|
|
49287
49301
|
` + "• When unclear whether the user wants monitoring (real-time) or data extraction (regular), ask them to clarify before creating the workflow.",
|
|
49288
49302
|
inputSchema: {
|
|
49289
49303
|
prompt: exports_external.string().describe('Natural language description of what to extract (e.g., "Extract product prices and names")'),
|
|
49290
|
-
|
|
49304
|
+
url: exports_external.string().optional().describe("Single URL — prefer using 'urls' instead. If both are provided, 'urls' takes precedence."),
|
|
49305
|
+
urls: exports_external.preprocess(coerceArray(true), exports_external.array(exports_external.string()).min(1)).optional().describe("Starting URLs for the workflow (array of strings). Also accepts a single URL string."),
|
|
49291
49306
|
name: exports_external.string().optional().describe("Optional name for the workflow"),
|
|
49292
49307
|
entity: exports_external.string().optional().describe("Entity name for extraction (e.g., 'Product', 'Job Posting')"),
|
|
49293
|
-
schema: exports_external.array(exports_external.object(SchemaFieldShape)).optional().describe("Extraction schema fields. If omitted, the AI agent auto-detects the schema."),
|
|
49308
|
+
schema: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.object(SchemaFieldShape))).optional().describe("Extraction schema fields. If omitted, the AI agent auto-detects the schema."),
|
|
49294
49309
|
interval: exports_external.enum([
|
|
49295
49310
|
"ONLY_ONCE",
|
|
49296
49311
|
"EVERY_10_MINUTES",
|
|
@@ -49324,6 +49339,10 @@ function registerTools(server, ctx) {
|
|
|
49324
49339
|
},
|
|
49325
49340
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
|
|
49326
49341
|
}, withErrorHandling("create_workflow", async (args) => {
|
|
49342
|
+
const urls = args.urls ?? (args.url ? [args.url] : []);
|
|
49343
|
+
if (urls.length === 0) {
|
|
49344
|
+
return errorResult("At least one URL is required. Provide 'urls' (array) or 'url' (string).");
|
|
49345
|
+
}
|
|
49327
49346
|
const n = args.notifications;
|
|
49328
49347
|
const hasNotifications = n && (n.email || n.webhook || n.slack || n.websocket);
|
|
49329
49348
|
if (args.interval === "REAL_TIME" && !hasNotifications) {
|
|
@@ -49338,7 +49357,7 @@ function registerTools(server, ctx) {
|
|
|
49338
49357
|
} : undefined;
|
|
49339
49358
|
const isRealTime = args.interval === "REAL_TIME";
|
|
49340
49359
|
let builder = ctx.client.extract({
|
|
49341
|
-
urls
|
|
49360
|
+
urls,
|
|
49342
49361
|
name: args.name || "Untitled Workflow",
|
|
49343
49362
|
...isRealTime ? {} : { navigationMode: "agentic-navigation" },
|
|
49344
49363
|
userPrompt: args.prompt,
|
|
@@ -49530,11 +49549,11 @@ function registerTools(server, ctx) {
|
|
|
49530
49549
|
inputSchema: {
|
|
49531
49550
|
workflowId: exports_external.string().describe("The workflow ID to update"),
|
|
49532
49551
|
name: exports_external.string().optional().describe("New name for the workflow"),
|
|
49533
|
-
urls: exports_external.array(exports_external.string()).optional().describe("New target URLs for the workflow"),
|
|
49552
|
+
urls: exports_external.preprocess(coerceArray(true), exports_external.array(exports_external.string()).min(1)).optional().describe("New target URLs for the workflow (array of strings). Also accepts a single URL string."),
|
|
49534
49553
|
entity: exports_external.string().optional().describe("Entity name for extraction (e.g., 'Product', 'Job Posting')"),
|
|
49535
|
-
schema: exports_external.array(exports_external.object(SchemaFieldShape)).optional().describe("New extraction schema fields"),
|
|
49554
|
+
schema: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.object(SchemaFieldShape))).optional().describe("New extraction schema fields"),
|
|
49536
49555
|
description: exports_external.string().optional().describe("Workflow description"),
|
|
49537
|
-
tags: exports_external.array(exports_external.string()).optional().describe("Tags for organizing workflows"),
|
|
49556
|
+
tags: exports_external.preprocess(coerceArray(true), exports_external.array(exports_external.string())).optional().describe("Tags for organizing workflows"),
|
|
49538
49557
|
userPrompt: exports_external.string().optional().describe("Navigation prompt for agentic-navigation mode (10-5000 characters)"),
|
|
49539
49558
|
updateInterval: exports_external.enum([
|
|
49540
49559
|
"ONLY_ONCE",
|
|
@@ -49555,7 +49574,7 @@ function registerTools(server, ctx) {
|
|
|
49555
49574
|
"MONTHLY",
|
|
49556
49575
|
"CUSTOM"
|
|
49557
49576
|
]).optional().describe("How often the workflow should run. CUSTOM requires schedules. Note: REAL_TIME is NOT allowed here — real-time workflows must be created via create_workflow."),
|
|
49558
|
-
schedules: exports_external.array(exports_external.string()).optional().describe("Cron expressions for CUSTOM update interval"),
|
|
49577
|
+
schedules: exports_external.preprocess(coerceArray(true), exports_external.array(exports_external.string())).optional().describe("Cron expressions for CUSTOM update interval"),
|
|
49559
49578
|
limit: exports_external.number().optional().describe("Maximum number of records to extract per run")
|
|
49560
49579
|
},
|
|
49561
49580
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }
|