@kadoa/mcp 0.3.0 → 0.3.1-rc.0
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 +71 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49226,14 +49226,54 @@ function withErrorHandling(name, handler) {
|
|
|
49226
49226
|
};
|
|
49227
49227
|
}
|
|
49228
49228
|
function registerTools(server, ctx) {
|
|
49229
|
+
server.registerTool("whoami", {
|
|
49230
|
+
description: "Show current user details: email, authentication method, and team memberships",
|
|
49231
|
+
inputSchema: {},
|
|
49232
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
|
|
49233
|
+
}, withErrorHandling("whoami", async () => {
|
|
49234
|
+
const jwt2 = await getValidJwt(ctx);
|
|
49235
|
+
const user = await ctx.client.user.getCurrentUser();
|
|
49236
|
+
const authMethod = jwt2 ? "OAuth (JWT)" : "API Key";
|
|
49237
|
+
const teams = await ctx.client.listTeams(jwt2 ? { bearerToken: jwt2 } : undefined);
|
|
49238
|
+
const config2 = loadConfig2();
|
|
49239
|
+
const activeTeamId = ctx.teamId ?? config2.teamId ?? teams[0]?.id;
|
|
49240
|
+
return jsonResult({
|
|
49241
|
+
email: user.email,
|
|
49242
|
+
authMethod,
|
|
49243
|
+
teams: teams.map((t) => ({
|
|
49244
|
+
name: t.name,
|
|
49245
|
+
role: t.role,
|
|
49246
|
+
...t.id === activeTeamId ? { active: true } : {}
|
|
49247
|
+
}))
|
|
49248
|
+
});
|
|
49249
|
+
}));
|
|
49229
49250
|
server.registerTool("create_workflow", {
|
|
49230
|
-
description: "Create a new agentic navigation
|
|
49251
|
+
description: "Create a new workflow that extracts data using agentic navigation. Supports one-time, scheduled, and real-time (continuous monitoring) modes via the interval parameter. If entity and schema are provided, they guide the extraction. Otherwise, the AI agent auto-detects the schema from the page based on the prompt. The workflow runs asynchronously and may take several minutes. Do NOT poll or sleep-wait for completion. Instead, return the workflow ID to the user and let them check back later with get_workflow or fetch_data.",
|
|
49231
49252
|
inputSchema: {
|
|
49232
49253
|
prompt: exports_external.string().describe('Natural language description of what to extract (e.g., "Extract product prices and names")'),
|
|
49233
49254
|
urls: exports_external.array(exports_external.string()).min(1).describe("Starting URLs for the workflow"),
|
|
49234
49255
|
name: exports_external.string().optional().describe("Optional name for the workflow"),
|
|
49235
49256
|
entity: exports_external.string().optional().describe("Entity name for extraction (e.g., 'Product', 'Job Posting')"),
|
|
49236
|
-
schema: exports_external.array(exports_external.object(SchemaFieldShape)).optional().describe("Extraction schema fields. If omitted, the AI agent auto-detects the schema.")
|
|
49257
|
+
schema: exports_external.array(exports_external.object(SchemaFieldShape)).optional().describe("Extraction schema fields. If omitted, the AI agent auto-detects the schema."),
|
|
49258
|
+
interval: exports_external.enum([
|
|
49259
|
+
"ONLY_ONCE",
|
|
49260
|
+
"EVERY_10_MINUTES",
|
|
49261
|
+
"HALF_HOURLY",
|
|
49262
|
+
"HOURLY",
|
|
49263
|
+
"THREE_HOURLY",
|
|
49264
|
+
"SIX_HOURLY",
|
|
49265
|
+
"TWELVE_HOURLY",
|
|
49266
|
+
"EIGHTEEN_HOURLY",
|
|
49267
|
+
"DAILY",
|
|
49268
|
+
"TWO_DAY",
|
|
49269
|
+
"THREE_DAY",
|
|
49270
|
+
"WEEKLY",
|
|
49271
|
+
"BIWEEKLY",
|
|
49272
|
+
"TRIWEEKLY",
|
|
49273
|
+
"FOUR_WEEKS",
|
|
49274
|
+
"MONTHLY",
|
|
49275
|
+
"REAL_TIME"
|
|
49276
|
+
]).optional().describe("How often the workflow runs. Defaults to ONLY_ONCE. Use REAL_TIME for continuous monitoring.")
|
|
49237
49277
|
},
|
|
49238
49278
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
|
|
49239
49279
|
}, withErrorHandling("create_workflow", async (args) => {
|
|
@@ -49249,12 +49289,14 @@ function registerTools(server, ctx) {
|
|
|
49249
49289
|
name: args.name || "Untitled Workflow",
|
|
49250
49290
|
navigationMode: "agentic-navigation",
|
|
49251
49291
|
userPrompt: args.prompt,
|
|
49252
|
-
extraction
|
|
49292
|
+
extraction,
|
|
49293
|
+
interval: args.interval
|
|
49253
49294
|
}).create();
|
|
49295
|
+
const message = args.interval === "REAL_TIME" ? "Workflow created successfully. This real-time workflow monitors continuously — no manual runs needed. Use fetch_data to retrieve the latest extracted results." : "Workflow created successfully. The AI agent will start extracting data automatically.";
|
|
49254
49296
|
return jsonResult({
|
|
49255
49297
|
success: true,
|
|
49256
49298
|
workflowId: workflow.workflowId,
|
|
49257
|
-
message
|
|
49299
|
+
message
|
|
49258
49300
|
});
|
|
49259
49301
|
}));
|
|
49260
49302
|
server.registerTool("list_workflows", {
|
|
@@ -49298,6 +49340,7 @@ function registerTools(server, ctx) {
|
|
|
49298
49340
|
urls: workflow.urls,
|
|
49299
49341
|
schema: workflow.schema,
|
|
49300
49342
|
navigationMode: workflow.navigationMode,
|
|
49343
|
+
updateInterval: workflow.updateInterval,
|
|
49301
49344
|
totalRecords: workflow.totalRecords,
|
|
49302
49345
|
startedAt: workflow.startedAt,
|
|
49303
49346
|
finishedAt: workflow.finishedAt,
|
|
@@ -49313,6 +49356,10 @@ function registerTools(server, ctx) {
|
|
|
49313
49356
|
},
|
|
49314
49357
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
|
|
49315
49358
|
}, withErrorHandling("run_workflow", async (args) => {
|
|
49359
|
+
const workflow = await ctx.client.workflow.get(args.workflowId);
|
|
49360
|
+
if (workflow.updateInterval === "REAL_TIME") {
|
|
49361
|
+
return errorResult("Real-time workflows run continuously and cannot be triggered manually. " + "Use fetch_data to retrieve the latest extracted results.");
|
|
49362
|
+
}
|
|
49316
49363
|
const result = await ctx.client.workflow.runWorkflow(args.workflowId, {
|
|
49317
49364
|
limit: args.limit || 1000
|
|
49318
49365
|
});
|
|
@@ -49380,7 +49427,26 @@ function registerTools(server, ctx) {
|
|
|
49380
49427
|
description: exports_external.string().optional().describe("Workflow description"),
|
|
49381
49428
|
tags: exports_external.array(exports_external.string()).optional().describe("Tags for organizing workflows"),
|
|
49382
49429
|
userPrompt: exports_external.string().optional().describe("Navigation prompt for agentic-navigation mode (10-5000 characters)"),
|
|
49383
|
-
updateInterval: exports_external.enum([
|
|
49430
|
+
updateInterval: exports_external.enum([
|
|
49431
|
+
"ONLY_ONCE",
|
|
49432
|
+
"EVERY_10_MINUTES",
|
|
49433
|
+
"HALF_HOURLY",
|
|
49434
|
+
"HOURLY",
|
|
49435
|
+
"THREE_HOURLY",
|
|
49436
|
+
"SIX_HOURLY",
|
|
49437
|
+
"TWELVE_HOURLY",
|
|
49438
|
+
"EIGHTEEN_HOURLY",
|
|
49439
|
+
"DAILY",
|
|
49440
|
+
"TWO_DAY",
|
|
49441
|
+
"THREE_DAY",
|
|
49442
|
+
"WEEKLY",
|
|
49443
|
+
"BIWEEKLY",
|
|
49444
|
+
"TRIWEEKLY",
|
|
49445
|
+
"FOUR_WEEKS",
|
|
49446
|
+
"MONTHLY",
|
|
49447
|
+
"REAL_TIME",
|
|
49448
|
+
"CUSTOM"
|
|
49449
|
+
]).optional().describe("How often the workflow should run. Use REAL_TIME for continuous monitoring, CUSTOM with schedules for cron-based."),
|
|
49384
49450
|
schedules: exports_external.array(exports_external.string()).optional().describe("Cron expressions for CUSTOM update interval"),
|
|
49385
49451
|
limit: exports_external.number().optional().describe("Maximum number of records to extract per run")
|
|
49386
49452
|
},
|