@xano/developer-mcp 1.0.35 → 1.0.36
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/README.md +17 -2
- package/dist/xanoscript.js +31 -1
- package/dist/xanoscript.test.js +6 -0
- package/dist/xanoscript_docs/README.md +42 -42
- package/dist/xanoscript_docs/addons.md +10 -0
- package/dist/xanoscript_docs/agents.md +15 -0
- package/dist/xanoscript_docs/apis.md +45 -24
- package/dist/xanoscript_docs/cheatsheet.md +252 -0
- package/dist/xanoscript_docs/database.md +23 -0
- package/dist/xanoscript_docs/docs_index.json +236 -0
- package/dist/xanoscript_docs/frontend.md +10 -0
- package/dist/xanoscript_docs/functions.md +4 -0
- package/dist/xanoscript_docs/integrations/cloud-storage.md +142 -0
- package/dist/xanoscript_docs/integrations/external-apis.md +201 -0
- package/dist/xanoscript_docs/integrations/redis.md +194 -0
- package/dist/xanoscript_docs/integrations/search.md +242 -0
- package/dist/xanoscript_docs/integrations/utilities.md +331 -0
- package/dist/xanoscript_docs/integrations.md +55 -901
- package/dist/xanoscript_docs/mcp-servers.md +10 -0
- package/dist/xanoscript_docs/performance.md +15 -0
- package/dist/xanoscript_docs/quickstart.md +22 -88
- package/dist/xanoscript_docs/run.md +10 -0
- package/dist/xanoscript_docs/security.md +26 -0
- package/dist/xanoscript_docs/streaming.md +10 -0
- package/dist/xanoscript_docs/syntax.md +56 -0
- package/dist/xanoscript_docs/tables.md +15 -0
- package/dist/xanoscript_docs/tasks.md +11 -0
- package/dist/xanoscript_docs/tools.md +15 -0
- package/dist/xanoscript_docs/triggers.md +57 -192
- package/dist/xanoscript_docs/types.md +4 -0
- package/package.json +1 -1
|
@@ -6,6 +6,22 @@ applyTo: "*/trigger/**/*.xs"
|
|
|
6
6
|
|
|
7
7
|
Event-driven handlers that execute in response to system events. Triggers allow you to react to database changes, real-time messages, workspace events, agent connections, and MCP server tool calls.
|
|
8
8
|
|
|
9
|
+
> **TL;DR:** Triggers respond to events. Types: `table_trigger` (CRUD events), `realtime_trigger` (channel events), `workspace_trigger` (branch events), `agent_trigger` (AI events), `mcp_server_trigger` (MCP events). Each has predefined input blocks.
|
|
10
|
+
|
|
11
|
+
## Section Index
|
|
12
|
+
|
|
13
|
+
| Section | Contents |
|
|
14
|
+
|---------|----------|
|
|
15
|
+
| [Quick Reference](#quick-reference) | Trigger types summary |
|
|
16
|
+
| [Predefined Input Blocks](#predefined-input-blocks) | All input schemas (reference once) |
|
|
17
|
+
| [Table Trigger](#table-trigger) | Database CRUD event handlers |
|
|
18
|
+
| [Realtime Trigger](#realtime-trigger) | Channel event handlers |
|
|
19
|
+
| [Workspace Trigger](#workspace-trigger) | Branch lifecycle event handlers |
|
|
20
|
+
| [Agent Trigger](#agent-trigger) | AI agent event handlers |
|
|
21
|
+
| [MCP Server Trigger](#mcp-server-trigger) | MCP tool call handlers |
|
|
22
|
+
| [Common Patterns](#common-patterns) | Error handling, conditional logic |
|
|
23
|
+
| [Best Practices](#best-practices) | Guidelines for trigger development |
|
|
24
|
+
|
|
9
25
|
## Quick Reference
|
|
10
26
|
|
|
11
27
|
| Trigger Type | Purpose | Required Clauses |
|
|
@@ -159,15 +175,8 @@ table_trigger "<name>" {
|
|
|
159
175
|
description = "Description of this trigger"
|
|
160
176
|
tags = ["tag1", "tag2"]
|
|
161
177
|
|
|
162
|
-
//
|
|
163
|
-
input {
|
|
164
|
-
json new
|
|
165
|
-
json old
|
|
166
|
-
enum action {
|
|
167
|
-
values = ["insert", "update", "delete", "truncate"]
|
|
168
|
-
}
|
|
169
|
-
text datasource
|
|
170
|
-
}
|
|
178
|
+
// Uses predefined Table Trigger Input - see Predefined Input Blocks section
|
|
179
|
+
input { ... }
|
|
171
180
|
|
|
172
181
|
stack {
|
|
173
182
|
// Logic to execute when triggered
|
|
@@ -215,17 +224,11 @@ table_trigger "audit_user_changes" {
|
|
|
215
224
|
description = "Log all changes to user records"
|
|
216
225
|
datasources = ["main_db"]
|
|
217
226
|
|
|
218
|
-
//
|
|
219
|
-
input {
|
|
220
|
-
json new
|
|
221
|
-
json old
|
|
222
|
-
enum action {
|
|
223
|
-
values = ["insert", "update", "delete", "truncate"]
|
|
224
|
-
}
|
|
225
|
-
text datasource
|
|
226
|
-
}
|
|
227
|
+
// Uses predefined Table Trigger Input - see Predefined Input Blocks section
|
|
228
|
+
input { ... }
|
|
227
229
|
|
|
228
230
|
stack {
|
|
231
|
+
// Access input fields: $input.new, $input.old, $input.action, $input.datasource
|
|
229
232
|
db.add "audit_log" {
|
|
230
233
|
data = {
|
|
231
234
|
table_name: "user",
|
|
@@ -258,31 +261,8 @@ realtime_trigger "<name>" {
|
|
|
258
261
|
description = "Description of this trigger"
|
|
259
262
|
tags = ["tag1", "tag2"]
|
|
260
263
|
|
|
261
|
-
//
|
|
262
|
-
input {
|
|
263
|
-
enum action {
|
|
264
|
-
values = ["message", "join"]
|
|
265
|
-
}
|
|
266
|
-
text channel
|
|
267
|
-
object client {
|
|
268
|
-
schema {
|
|
269
|
-
json extras
|
|
270
|
-
object permissions {
|
|
271
|
-
schema {
|
|
272
|
-
int dbo_id
|
|
273
|
-
text row_id
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
object options {
|
|
279
|
-
schema {
|
|
280
|
-
bool authenticated
|
|
281
|
-
text channel
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
json payload
|
|
285
|
-
}
|
|
264
|
+
// Uses predefined Realtime Trigger Input - see Predefined Input Blocks section
|
|
265
|
+
input { ... }
|
|
286
266
|
|
|
287
267
|
stack {
|
|
288
268
|
// Logic to execute when triggered
|
|
@@ -329,33 +309,11 @@ realtime_trigger "chat_message_handler" {
|
|
|
329
309
|
active = true
|
|
330
310
|
description = "Handle chat room messages and joins"
|
|
331
311
|
|
|
332
|
-
//
|
|
333
|
-
input {
|
|
334
|
-
enum action {
|
|
335
|
-
values = ["message", "join"]
|
|
336
|
-
}
|
|
337
|
-
text channel
|
|
338
|
-
object client {
|
|
339
|
-
schema {
|
|
340
|
-
json extras
|
|
341
|
-
object permissions {
|
|
342
|
-
schema {
|
|
343
|
-
int dbo_id
|
|
344
|
-
text row_id
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
object options {
|
|
350
|
-
schema {
|
|
351
|
-
bool authenticated
|
|
352
|
-
text channel
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
json payload
|
|
356
|
-
}
|
|
312
|
+
// Uses predefined Realtime Trigger Input - see Predefined Input Blocks section
|
|
313
|
+
input { ... }
|
|
357
314
|
|
|
358
315
|
stack {
|
|
316
|
+
// Access input fields: $input.action, $input.channel, $input.client, $input.options, $input.payload
|
|
359
317
|
conditional {
|
|
360
318
|
if ($input.action == "join") {
|
|
361
319
|
var $welcome { value = "Welcome to the chat!" }
|
|
@@ -395,24 +353,8 @@ workspace_trigger "<name>" {
|
|
|
395
353
|
description = "Description of this trigger"
|
|
396
354
|
tags = ["tag1", "tag2"]
|
|
397
355
|
|
|
398
|
-
//
|
|
399
|
-
input {
|
|
400
|
-
object to_branch {
|
|
401
|
-
schema {
|
|
402
|
-
int id
|
|
403
|
-
text label
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
object from_branch {
|
|
407
|
-
schema {
|
|
408
|
-
int id
|
|
409
|
-
text label
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
enum action {
|
|
413
|
-
values = ["branch_live", "branch_merge", "branch_new"]
|
|
414
|
-
}
|
|
415
|
-
}
|
|
356
|
+
// Uses predefined Workspace Trigger Input - see Predefined Input Blocks section
|
|
357
|
+
input { ... }
|
|
416
358
|
|
|
417
359
|
stack {
|
|
418
360
|
// Logic to execute when triggered
|
|
@@ -456,26 +398,11 @@ workspace_trigger "branch_notification" {
|
|
|
456
398
|
description = "Send notifications on branch events"
|
|
457
399
|
tags = ["devops", "notifications"]
|
|
458
400
|
|
|
459
|
-
//
|
|
460
|
-
input {
|
|
461
|
-
object to_branch {
|
|
462
|
-
schema {
|
|
463
|
-
int id
|
|
464
|
-
text label
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
object from_branch {
|
|
468
|
-
schema {
|
|
469
|
-
int id
|
|
470
|
-
text label
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
enum action {
|
|
474
|
-
values = ["branch_live", "branch_merge", "branch_new"]
|
|
475
|
-
}
|
|
476
|
-
}
|
|
401
|
+
// Uses predefined Workspace Trigger Input - see Predefined Input Blocks section
|
|
402
|
+
input { ... }
|
|
477
403
|
|
|
478
404
|
stack {
|
|
405
|
+
// Access input fields: $input.to_branch, $input.from_branch, $input.action
|
|
479
406
|
util.send_email {
|
|
480
407
|
service_provider = "resend"
|
|
481
408
|
api_key = $env.RESEND_API_KEY
|
|
@@ -507,23 +434,8 @@ agent_trigger "<name>" {
|
|
|
507
434
|
docs = "Extended documentation for the trigger"
|
|
508
435
|
tags = ["tag1", "tag2"]
|
|
509
436
|
|
|
510
|
-
//
|
|
511
|
-
input {
|
|
512
|
-
object toolset {
|
|
513
|
-
schema {
|
|
514
|
-
int id
|
|
515
|
-
text name
|
|
516
|
-
text instructions
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
object[] tools {
|
|
520
|
-
schema {
|
|
521
|
-
int id
|
|
522
|
-
text name
|
|
523
|
-
text instructions
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
437
|
+
// Uses predefined Agent Trigger Input - see Predefined Input Blocks section
|
|
438
|
+
input { ... }
|
|
527
439
|
|
|
528
440
|
stack {
|
|
529
441
|
// Logic to execute when triggered
|
|
@@ -571,26 +483,11 @@ agent_trigger "assistant_handler" {
|
|
|
571
483
|
description = "Handle customer assistant agent connections"
|
|
572
484
|
docs = "This trigger initializes the customer context when the agent connects"
|
|
573
485
|
|
|
574
|
-
//
|
|
575
|
-
input {
|
|
576
|
-
object toolset {
|
|
577
|
-
schema {
|
|
578
|
-
int id
|
|
579
|
-
text name
|
|
580
|
-
text instructions
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
object[] tools {
|
|
584
|
-
schema {
|
|
585
|
-
int id
|
|
586
|
-
text name
|
|
587
|
-
text instructions
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
486
|
+
// Uses predefined Agent Trigger Input - see Predefined Input Blocks section
|
|
487
|
+
input { ... }
|
|
591
488
|
|
|
592
489
|
stack {
|
|
593
|
-
// Access
|
|
490
|
+
// Access input fields: $input.toolset, $input.tools
|
|
594
491
|
var $context {
|
|
595
492
|
value = {
|
|
596
493
|
toolset_name: $input.toolset.name,
|
|
@@ -622,23 +519,8 @@ mcp_server_trigger "<name>" {
|
|
|
622
519
|
description = "Description of this trigger"
|
|
623
520
|
tags = ["tag1", "tag2"]
|
|
624
521
|
|
|
625
|
-
//
|
|
626
|
-
input {
|
|
627
|
-
object toolset {
|
|
628
|
-
schema {
|
|
629
|
-
int id
|
|
630
|
-
text name
|
|
631
|
-
text instructions
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
object[] tools {
|
|
635
|
-
schema {
|
|
636
|
-
int id
|
|
637
|
-
text name
|
|
638
|
-
text instructions
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}
|
|
522
|
+
// Uses predefined MCP Server Trigger Input - see Predefined Input Blocks section
|
|
523
|
+
input { ... }
|
|
642
524
|
|
|
643
525
|
stack {
|
|
644
526
|
// Logic to execute when triggered
|
|
@@ -685,26 +567,11 @@ mcp_server_trigger "database_tool_handler" {
|
|
|
685
567
|
description = "Handle database tool calls from MCP clients"
|
|
686
568
|
tags = ["mcp", "database"]
|
|
687
569
|
|
|
688
|
-
//
|
|
689
|
-
input {
|
|
690
|
-
object toolset {
|
|
691
|
-
schema {
|
|
692
|
-
int id
|
|
693
|
-
text name
|
|
694
|
-
text instructions
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
object[] tools {
|
|
698
|
-
schema {
|
|
699
|
-
int id
|
|
700
|
-
text name
|
|
701
|
-
text instructions
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}
|
|
570
|
+
// Uses predefined MCP Server Trigger Input - see Predefined Input Blocks section
|
|
571
|
+
input { ... }
|
|
705
572
|
|
|
706
573
|
stack {
|
|
707
|
-
// Access
|
|
574
|
+
// Access input fields: $input.toolset, $input.tools
|
|
708
575
|
var $result {
|
|
709
576
|
value = {
|
|
710
577
|
server: $input.toolset.name,
|
|
@@ -731,15 +598,8 @@ table_trigger "safe_audit" {
|
|
|
731
598
|
table = "sensitive_data"
|
|
732
599
|
actions = {insert: true, update: true, delete: true, truncate: false}
|
|
733
600
|
|
|
734
|
-
// Input
|
|
735
|
-
input {
|
|
736
|
-
json new
|
|
737
|
-
json old
|
|
738
|
-
enum action {
|
|
739
|
-
values = ["insert", "update", "delete", "truncate"]
|
|
740
|
-
}
|
|
741
|
-
text datasource
|
|
742
|
-
}
|
|
601
|
+
// Uses predefined Table Trigger Input - see Predefined Input Blocks section
|
|
602
|
+
input { ... }
|
|
743
603
|
|
|
744
604
|
stack {
|
|
745
605
|
try_catch {
|
|
@@ -768,15 +628,8 @@ table_trigger "conditional_notification" {
|
|
|
768
628
|
table = "order"
|
|
769
629
|
actions = {insert: true, update: false, delete: false, truncate: false}
|
|
770
630
|
|
|
771
|
-
// Input
|
|
772
|
-
input {
|
|
773
|
-
json new
|
|
774
|
-
json old
|
|
775
|
-
enum action {
|
|
776
|
-
values = ["insert", "update", "delete", "truncate"]
|
|
777
|
-
}
|
|
778
|
-
text datasource
|
|
779
|
-
}
|
|
631
|
+
// Uses predefined Table Trigger Input - see Predefined Input Blocks section
|
|
632
|
+
input { ... }
|
|
780
633
|
|
|
781
634
|
stack {
|
|
782
635
|
conditional {
|
|
@@ -807,3 +660,15 @@ table_trigger "conditional_notification" {
|
|
|
807
660
|
6. **Use tags** - Organize triggers with meaningful tags for easier management
|
|
808
661
|
7. **Document with description** - Always provide a description explaining the trigger's purpose
|
|
809
662
|
8. **Test thoroughly** - Triggers execute automatically, so ensure they handle edge cases
|
|
663
|
+
|
|
664
|
+
---
|
|
665
|
+
|
|
666
|
+
## Related Topics
|
|
667
|
+
|
|
668
|
+
| Topic | Description |
|
|
669
|
+
|-------|-------------|
|
|
670
|
+
| `tables` | Table definitions that triggers respond to |
|
|
671
|
+
| `functions` | Reusable logic called from triggers |
|
|
672
|
+
| `agents` | Agent triggers for AI events |
|
|
673
|
+
| `mcp-servers` | MCP server triggers |
|
|
674
|
+
| `realtime` | Real-time channel configuration |
|
|
@@ -6,6 +6,10 @@ applyTo: "function/**/*.xs, api/**/*.xs, tool/**/*.xs, agent/**/*.xs"
|
|
|
6
6
|
|
|
7
7
|
Reference for XanoScript data types, input blocks, and validation.
|
|
8
8
|
|
|
9
|
+
> **TL;DR:** Use `text` not `string`, `int` not `integer`, `bool` not `boolean`. Add `?` for nullable, `?=value` for defaults. Use `filters=` for validation. Arrays use `type[]` syntax.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
9
13
|
## Quick Reference
|
|
10
14
|
|
|
11
15
|
### Primitive Types
|
package/package.json
CHANGED