@kadoa/mcp 0.3.12-rc.1 → 0.3.12-rc.3

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.
Files changed (2) hide show
  1. package/dist/index.js +255 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -51062,6 +51062,261 @@ function registerTools(server, ctx) {
51062
51062
  message: `Variable "${variableKey}" (${args.variableId}) deleted.`
51063
51063
  });
51064
51064
  }));
51065
+ server.registerTool("list_templates", {
51066
+ description: "List all templates in the current team. Templates define reusable configurations (prompt, schema, validation, notifications) that can be linked to multiple workflows.",
51067
+ inputSchema: strictSchema({}),
51068
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
51069
+ }, withErrorHandling("list_templates", async () => {
51070
+ const templates = await ctx.client.template.list();
51071
+ return jsonResult({ templates, count: templates.length });
51072
+ }));
51073
+ server.registerTool("get_template", {
51074
+ description: "Get a template by ID, including all published versions.",
51075
+ inputSchema: strictSchema({
51076
+ templateId: exports_external.string().describe("The template ID")
51077
+ }),
51078
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
51079
+ }, withErrorHandling("get_template", async (args) => {
51080
+ const template = await ctx.client.template.get(args.templateId);
51081
+ return jsonResult({ template });
51082
+ }));
51083
+ server.registerTool("create_template", {
51084
+ description: "Create a new template. Templates define reusable configurations that can be linked to workflows. After creation, use create_template_version to publish a version with prompt, schema, and validation rules.",
51085
+ inputSchema: strictSchema({
51086
+ name: exports_external.string().describe("Template name (1-255 chars)"),
51087
+ description: exports_external.string().optional().describe("Template description (max 2000 chars)")
51088
+ }),
51089
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
51090
+ }, withErrorHandling("create_template", async (args) => {
51091
+ const template = await ctx.client.template.create({
51092
+ name: args.name,
51093
+ ...args.description != null && { description: args.description }
51094
+ });
51095
+ return jsonResult({
51096
+ success: true,
51097
+ template,
51098
+ message: `Template "${template.name}" created. Use create_template_version to publish a version.`
51099
+ });
51100
+ }));
51101
+ server.registerTool("update_template", {
51102
+ description: "Update a template's name or description. At least one field must be provided.",
51103
+ inputSchema: strictSchema({
51104
+ templateId: exports_external.string().describe("The template ID to update"),
51105
+ name: exports_external.string().optional().describe("New template name"),
51106
+ description: exports_external.string().optional().describe("New template description")
51107
+ }),
51108
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }
51109
+ }, withErrorHandling("update_template", async (args) => {
51110
+ const { templateId, ...updates } = args;
51111
+ const template = await ctx.client.template.update(templateId, updates);
51112
+ return jsonResult({
51113
+ success: true,
51114
+ template,
51115
+ message: "Template updated."
51116
+ });
51117
+ }));
51118
+ server.registerTool("delete_template", {
51119
+ description: "Delete (archive) a template. Existing linked workflows keep their current config but are unlinked. " + "You MUST first call this tool without confirmed=true to preview what will be deleted, " + "then show the user the template name and ask for confirmation, " + "then call again with confirmed=true only after the user explicitly agrees.",
51120
+ inputSchema: strictSchema({
51121
+ templateId: exports_external.string().describe("The template ID to delete"),
51122
+ confirmed: exports_external.preprocess(coerceBoolean(), exports_external.boolean()).optional().describe("Set to true only after the user has explicitly confirmed deletion. Omit or set to false for the initial preview call.")
51123
+ }),
51124
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true }
51125
+ }, withErrorHandling("delete_template", async (args) => {
51126
+ let templateName = args.templateId;
51127
+ try {
51128
+ const template = await ctx.client.template.get(args.templateId);
51129
+ templateName = template.name || args.templateId;
51130
+ } catch {}
51131
+ if (!args.confirmed) {
51132
+ return jsonResult({
51133
+ pending: true,
51134
+ templateId: args.templateId,
51135
+ templateName,
51136
+ message: `⚠️ You are about to delete template "${templateName}". Linked workflows will keep their current config but will be unlinked. Ask the user to confirm, then call delete_template again with confirmed=true.`
51137
+ });
51138
+ }
51139
+ await ctx.client.template.delete(args.templateId);
51140
+ return jsonResult({
51141
+ success: true,
51142
+ message: `Template "${templateName}" (${args.templateId}) deleted.`
51143
+ });
51144
+ }));
51145
+ const TemplateSchemaFieldShape = {
51146
+ name: exports_external.string().describe("Field name"),
51147
+ description: exports_external.string().optional().describe("Field description"),
51148
+ fieldType: exports_external.string().optional().describe("Field type (e.g. SCHEMA)"),
51149
+ example: exports_external.string().optional().describe("Example value"),
51150
+ dataType: exports_external.string().optional().describe("Data type (STRING, NUMBER, DATE, LINK, etc.)"),
51151
+ isKey: exports_external.preprocess(coerceBoolean(), exports_external.boolean()).optional().describe("Whether the field is a key field")
51152
+ };
51153
+ server.registerTool("create_template_version", {
51154
+ description: "Publish a new version of a template. Versions capture the full workflow config: prompt, schema, validation rules, and notifications. All fields are optional — include only what this version should set.",
51155
+ inputSchema: strictSchema({
51156
+ templateId: exports_external.string().describe("The template ID to publish a version for"),
51157
+ prompt: exports_external.string().optional().describe("User prompt to copy into workflow config"),
51158
+ schemaId: exports_external.string().optional().describe("Existing schema ID to reference (mutually exclusive with schemaFields)"),
51159
+ schemaFields: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.object(TemplateSchemaFieldShape))).optional().describe("Inline schema fields to create a new schema (mutually exclusive with schemaId)"),
51160
+ schemaEntity: exports_external.string().optional().describe("Entity name for the inline schema"),
51161
+ dataValidation: exports_external.preprocess(coerceJson(), exports_external.object({
51162
+ config: exports_external.object({
51163
+ enabled: exports_external.preprocess(coerceBoolean(), exports_external.boolean()).describe("Whether data validation is enabled"),
51164
+ alerting: exports_external.object({
51165
+ system: exports_external.object({
51166
+ enabled: exports_external.preprocess(coerceBoolean(), exports_external.boolean()),
51167
+ threshold: exports_external.preprocess(coerceNumber(), exports_external.number()).optional()
51168
+ }).optional().describe("System alerting configuration"),
51169
+ user: exports_external.object({
51170
+ enabled: exports_external.preprocess(coerceBoolean(), exports_external.boolean()),
51171
+ threshold: exports_external.preprocess(coerceNumber(), exports_external.number()).optional()
51172
+ }).optional().describe("User alerting configuration")
51173
+ }).optional().describe("Alerting configuration")
51174
+ }).optional().describe("Data validation config to copy into workflow.config.dataValidation"),
51175
+ rules: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.object({
51176
+ name: exports_external.string().describe("Rule name"),
51177
+ description: exports_external.string().optional().describe("Rule description"),
51178
+ ruleType: exports_external.enum(["regex", "custom_sql", "llm"]).describe("Type of validation rule"),
51179
+ targetColumns: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.string())).optional().describe("Columns this rule targets"),
51180
+ parameters: exports_external.preprocess(coerceJson(), exports_external.record(exports_external.string(), exports_external.unknown())).describe("Rule parameters (e.g., {sql: '...', pattern: '...'})"),
51181
+ status: exports_external.enum(["preview", "enabled", "disabled"]).optional().describe("Initial rule status (defaults to 'enabled')"),
51182
+ metadata: exports_external.preprocess(coerceJson(), exports_external.record(exports_external.string(), exports_external.unknown())).optional().describe("Additional metadata")
51183
+ }))).optional().describe("Validation rules to clone as data_validation rows")
51184
+ })).optional().describe("Data validation configuration: { config?: { enabled, alerting? }, rules?: [{ name, ruleType, parameters, ... }] }"),
51185
+ notifications: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.object({
51186
+ eventType: exports_external.string().describe("Notification event type"),
51187
+ eventConfiguration: exports_external.preprocess(coerceJson(), exports_external.record(exports_external.string(), exports_external.unknown())).optional(),
51188
+ enabled: exports_external.preprocess(coerceBoolean(), exports_external.boolean()).optional(),
51189
+ channelIds: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.string())).optional(),
51190
+ channels: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.object({ channelId: exports_external.string() }))).optional()
51191
+ }))).optional().describe("Notification configuration for this version")
51192
+ }),
51193
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
51194
+ }, withErrorHandling("create_template_version", async (args) => {
51195
+ const { templateId, ...body } = args;
51196
+ const version2 = await ctx.client.template.createVersion(templateId, body);
51197
+ return jsonResult({
51198
+ success: true,
51199
+ version: version2,
51200
+ message: `Version ${version2.version} published for template ${templateId}.`
51201
+ });
51202
+ }));
51203
+ server.registerTool("list_template_workflows", {
51204
+ description: "List all workflows linked to a template.",
51205
+ inputSchema: strictSchema({
51206
+ templateId: exports_external.string().describe("The template ID")
51207
+ }),
51208
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
51209
+ }, withErrorHandling("list_template_workflows", async (args) => {
51210
+ const workflows = await ctx.client.template.listWorkflows(args.templateId);
51211
+ return jsonResult({ workflows, count: workflows.length });
51212
+ }));
51213
+ server.registerTool("link_workflows_to_template", {
51214
+ description: "Link workflows to a template. Linking applies the template's latest version config to the workflows. " + "Without force, fails if any workflow is already linked to a different template. With force=true, relinks them. " + "You MUST first call without confirmed=true to preview, then ask the user for confirmation, " + "then call again with confirmed=true.",
51215
+ inputSchema: strictSchema({
51216
+ templateId: exports_external.string().describe("The template ID to link workflows to"),
51217
+ workflowIds: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.string())).describe("Array of workflow IDs to link"),
51218
+ force: exports_external.preprocess(coerceBoolean(), exports_external.boolean()).optional().describe("If true, relink workflows already linked to another template"),
51219
+ confirmed: exports_external.preprocess(coerceBoolean(), exports_external.boolean()).optional().describe("Set to true only after user confirms. Omit for preview.")
51220
+ }),
51221
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
51222
+ }, withErrorHandling("link_workflows_to_template", async (args) => {
51223
+ if (!args.confirmed) {
51224
+ const forceNote = args.force ? " Workflows already linked to other templates will be relinked (force=true)." : " Will fail if any workflow is already linked to a different template.";
51225
+ return jsonResult({
51226
+ pending: true,
51227
+ templateId: args.templateId,
51228
+ workflowIds: args.workflowIds,
51229
+ force: !!args.force,
51230
+ message: `⚠️ You are about to link ${args.workflowIds.length} workflow(s) to template ${args.templateId}. This will apply the template's latest version config to these workflows.${forceNote} Ask the user to confirm, then call again with confirmed=true.`
51231
+ });
51232
+ }
51233
+ const result = await ctx.client.template.linkWorkflows(args.templateId, {
51234
+ workflowIds: args.workflowIds,
51235
+ ...args.force != null && { force: args.force }
51236
+ });
51237
+ return jsonResult({
51238
+ success: true,
51239
+ result,
51240
+ message: `Linked ${args.workflowIds.length} workflow(s) to template ${args.templateId}.`
51241
+ });
51242
+ }));
51243
+ server.registerTool("unlink_workflows_from_template", {
51244
+ description: "Unlink workflows from a template. Workflows keep their current config but are no longer associated with the template. " + "You MUST first call without confirmed=true to preview, then ask the user for confirmation, " + "then call again with confirmed=true.",
51245
+ inputSchema: strictSchema({
51246
+ templateId: exports_external.string().describe("The template ID to unlink workflows from"),
51247
+ workflowIds: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.string())).describe("Array of workflow IDs to unlink"),
51248
+ confirmed: exports_external.preprocess(coerceBoolean(), exports_external.boolean()).optional().describe("Set to true only after user confirms. Omit for preview.")
51249
+ }),
51250
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false }
51251
+ }, withErrorHandling("unlink_workflows_from_template", async (args) => {
51252
+ if (!args.confirmed) {
51253
+ return jsonResult({
51254
+ pending: true,
51255
+ templateId: args.templateId,
51256
+ workflowIds: args.workflowIds,
51257
+ message: `⚠️ You are about to unlink ${args.workflowIds.length} workflow(s) from template ${args.templateId}. Workflows will keep their current config. Ask the user to confirm, then call again with confirmed=true.`
51258
+ });
51259
+ }
51260
+ const result = await ctx.client.template.unlinkWorkflows(args.templateId, {
51261
+ workflowIds: args.workflowIds
51262
+ });
51263
+ return jsonResult({
51264
+ success: true,
51265
+ result,
51266
+ message: `Unlinked ${args.workflowIds.length} workflow(s) from template ${args.templateId}.`
51267
+ });
51268
+ }));
51269
+ server.registerTool("apply_template_update", {
51270
+ description: "Apply a specific template version to workflows. Updates the workflows' config (prompt, schema, validation, notifications) to match the specified version.",
51271
+ inputSchema: strictSchema({
51272
+ templateId: exports_external.string().describe("The template ID"),
51273
+ targetVersion: exports_external.preprocess(coerceNumber(), exports_external.number().int().min(1)).describe("Version number to apply"),
51274
+ workflowIds: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.string())).describe("Array of workflow IDs to update (max 100)")
51275
+ }),
51276
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
51277
+ }, withErrorHandling("apply_template_update", async (args) => {
51278
+ const result = await ctx.client.template.applyUpdate(args.templateId, {
51279
+ targetVersion: args.targetVersion,
51280
+ workflowIds: args.workflowIds
51281
+ });
51282
+ return jsonResult({
51283
+ success: true,
51284
+ result,
51285
+ message: `Applied version ${args.targetVersion} to ${args.workflowIds.length} workflow(s).`
51286
+ });
51287
+ }));
51288
+ server.registerTool("save_workflow_as_template", {
51289
+ description: "Create a template from an existing workflow's configuration (prompt, schema, validation, notifications). " + "Provide 'name' to create a new template, or 'templateId' to add a new version to an existing template.",
51290
+ inputSchema: strictSchema({
51291
+ workflowId: exports_external.string().describe("Source workflow ID to extract config from"),
51292
+ name: exports_external.string().optional().describe("Name for the new template (required if templateId is not set)"),
51293
+ description: exports_external.string().optional().describe("Description for the new template"),
51294
+ templateId: exports_external.string().optional().describe("Existing template ID to add a new version to (mutually exclusive with name)")
51295
+ }),
51296
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
51297
+ }, withErrorHandling("save_workflow_as_template", async (args) => {
51298
+ const result = await ctx.client.template.createFromWorkflow({
51299
+ workflowId: args.workflowId,
51300
+ ...args.name != null && { name: args.name },
51301
+ ...args.description != null && { description: args.description },
51302
+ ...args.templateId != null && { templateId: args.templateId }
51303
+ });
51304
+ return jsonResult({
51305
+ success: true,
51306
+ result,
51307
+ message: `Template created from workflow ${args.workflowId}.`
51308
+ });
51309
+ }));
51310
+ server.registerTool("list_template_schemas", {
51311
+ description: "List schemas associated with a template.",
51312
+ inputSchema: strictSchema({
51313
+ templateId: exports_external.string().describe("The template ID")
51314
+ }),
51315
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
51316
+ }, withErrorHandling("list_template_schemas", async (args) => {
51317
+ const schemas4 = await ctx.client.template.listSchemas(args.templateId);
51318
+ return jsonResult({ schemas: schemas4, count: schemas4.length });
51319
+ }));
51065
51320
  }
51066
51321
  var SchemaFieldShape, DASHBOARD_BASE_URL = "https://www.kadoa.com";
51067
51322
  var init_tools = __esm(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kadoa/mcp",
3
- "version": "0.3.12-rc.1",
3
+ "version": "0.3.12-rc.3",
4
4
  "description": "Kadoa MCP Server — manage workflows from Claude Desktop, Cursor, and other MCP clients",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "prepublishOnly": "bun run check-types && bun run test:unit && bun run build"
25
25
  },
26
26
  "dependencies": {
27
- "@kadoa/node-sdk": "^0.25.0",
27
+ "@kadoa/node-sdk": "^0.26.0",
28
28
  "@modelcontextprotocol/sdk": "^1.26.0",
29
29
  "express": "^5.2.1",
30
30
  "ioredis": "^5.6.1",