nana800-mcp-server 1.0.1 → 1.0.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 +49 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -445,10 +445,39 @@ var registerSchemeTools = (server) => {
445
445
 
446
446
  // src/tools/node.tools.ts
447
447
  import { z as z3 } from "zod";
448
+ var cachedNodesInfo = null;
449
+ var getNodesInfo = async () => {
450
+ if (cachedNodesInfo) return cachedNodesInfo;
451
+ const client = getApiClient();
452
+ cachedNodesInfo = await client.get("/info/nodes_info");
453
+ return cachedNodesInfo;
454
+ };
455
+ var validateTriggerType = async (triggerType) => {
456
+ const info = await getNodesInfo();
457
+ const availableTypes = info.trigger_types.map((t) => t.key);
458
+ return { valid: availableTypes.includes(triggerType), availableTypes };
459
+ };
460
+ var validateActionType = async (actionType) => {
461
+ const info = await getNodesInfo();
462
+ const availableTypes = info.action_types.map((t) => t.key);
463
+ return { valid: availableTypes.includes(actionType), availableTypes };
464
+ };
448
465
  var registerNodeTools = (server) => {
466
+ server.tool(
467
+ "get_nodes_info",
468
+ "Get information about available node types (trigger_types, action_types) and their configuration options. Call this first to see available types before creating nodes.",
469
+ {},
470
+ async () => {
471
+ const client = getApiClient();
472
+ const result = await client.get("/info/nodes_info");
473
+ return {
474
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
475
+ };
476
+ }
477
+ );
449
478
  server.tool(
450
479
  "node_create_trigger",
451
- "Create a new trigger node in a scheme. Triggers start the execution of automation workflows.",
480
+ "Create a new trigger node in a scheme. Triggers start the execution of automation workflows. Call get_nodes_info first to see available types.",
452
481
  {
453
482
  scheme: z3.string().optional().describe("The scheme ID where the trigger will be created (uses MCP_SCHEME_ID env if not provided)"),
454
483
  trigger_type: z3.string().describe("Type of trigger (e.g., WEBHOOK, INTERVAL, CODE_ACTION)"),
@@ -457,6 +486,15 @@ var registerNodeTools = (server) => {
457
486
  },
458
487
  async ({ scheme, trigger_type, slug, description }) => {
459
488
  try {
489
+ const validation = await validateTriggerType(trigger_type);
490
+ if (!validation.valid) {
491
+ return {
492
+ content: [{ type: "text", text: JSON.stringify({
493
+ success: false,
494
+ error: `Invalid trigger_type "${trigger_type}". Available types: ${validation.availableTypes.join(", ")}`
495
+ }, null, 2) }]
496
+ };
497
+ }
460
498
  const resolvedSchemeId = getSchemeId(scheme);
461
499
  const client = getApiClient();
462
500
  const body = { scheme: resolvedSchemeId, trigger_type };
@@ -475,7 +513,7 @@ var registerNodeTools = (server) => {
475
513
  );
476
514
  server.tool(
477
515
  "node_create_action",
478
- "Create a new action node in a scheme. Actions perform operations like sending emails, making HTTP requests, etc.",
516
+ "Create a new action node in a scheme. Actions perform operations like sending emails, making HTTP requests, etc. Call get_nodes_info first to see available types.",
479
517
  {
480
518
  scheme: z3.string().optional().describe("The scheme ID where the action will be created (uses MCP_SCHEME_ID env if not provided)"),
481
519
  action_type: z3.string().describe("Type of action (e.g., REQUEST, CONDITION, TG_BOT_MESSAGE_SEND, SET_CONTEXT_PARAM_DATA)"),
@@ -484,6 +522,15 @@ var registerNodeTools = (server) => {
484
522
  },
485
523
  async ({ scheme, action_type, slug, description }) => {
486
524
  try {
525
+ const validation = await validateActionType(action_type);
526
+ if (!validation.valid) {
527
+ return {
528
+ content: [{ type: "text", text: JSON.stringify({
529
+ success: false,
530
+ error: `Invalid action_type "${action_type}". Available types: ${validation.availableTypes.join(", ")}`
531
+ }, null, 2) }]
532
+ };
533
+ }
487
534
  const resolvedSchemeId = getSchemeId(scheme);
488
535
  const client = getApiClient();
489
536
  const body = { scheme: resolvedSchemeId, action_type };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nana800-mcp-server",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "MCP Server for nana800.io Public API - enables AI IDEs to interact with your no-code projects",
5
5
  "type": "module",
6
6
  "files": [