@xano/developer-mcp 2.3.0-beta.0 → 2.3.0-beta.10
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 +2 -1
- package/dist/cli_docs/topics/workspace.js +22 -4
- package/dist/meta_api_docs/topics/api.js +6 -6
- package/dist/meta_api_docs/topics/apigroup.js +2 -2
- package/dist/meta_api_docs/topics/authentication.js +1 -1
- package/dist/meta_api_docs/topics/history.js +42 -11
- package/dist/meta_api_docs/topics/mcp_server.js +6 -6
- package/dist/meta_api_docs/topics/middleware.js +1 -1
- package/dist/meta_api_docs/topics/table.js +2 -2
- package/dist/meta_api_docs/topics/workflows.js +1 -1
- package/dist/meta_api_docs/topics/workspace.js +1 -1
- package/dist/tools/validate_xanoscript.js +14 -5
- package/dist/xanoscript.d.ts +5 -0
- package/dist/xanoscript.js +3 -0
- package/dist/xanoscript_docs/README.md +25 -7
- package/dist/xanoscript_docs/agents.md +14 -5
- package/dist/xanoscript_docs/ai.md +820 -0
- package/dist/xanoscript_docs/branch.md +109 -29
- package/dist/xanoscript_docs/database.md +33 -1
- package/dist/xanoscript_docs/docs_index.json +36 -14
- package/dist/xanoscript_docs/essentials.md +53 -19
- package/dist/xanoscript_docs/file-uploads.md +4 -4
- package/dist/xanoscript_docs/mcp-servers.md +2 -2
- package/dist/xanoscript_docs/prompts.md +4 -2
- package/dist/xanoscript_docs/realtime-v2.md +4 -2
- package/dist/xanoscript_docs/resources.md +3 -1
- package/dist/xanoscript_docs/survival.md +1 -1
- package/dist/xanoscript_docs/tables.md +58 -0
- package/dist/xanoscript_docs/tools.md +1 -1
- package/dist/xanoscript_docs/triggers.md +133 -3
- package/dist/xanoscript_docs/types.md +14 -1
- package/dist/xanoscript_docs/unit-testing.md +29 -2
- package/dist/xanoscript_docs/version.json +2 -2
- package/dist/xanoscript_docs/workflow-tests.md +18 -0
- package/dist/xanoscript_docs/working.md +39 -10
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
applyTo: "realtime_server/**/*.xs, channel/**/*.xs, message/**/*.xs, channel_trigger/**/*.xs, realtime_server_trigger/**/*.xs"
|
|
2
|
+
applyTo: "realtime_server/**/*.xs, channel/**/*.xs, message/**/*.xs, channel_trigger/**/*.xs, realtime_server_trigger/**/*.xs, realtime/server/**/*.xs, realtime/channel_trigger/*.xs, realtime/server_trigger/*.xs"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Realtime V2
|
|
@@ -64,6 +64,8 @@ The declaration names the template `rooms/{room_id}`; a client joins a resolved
|
|
|
64
64
|
| `publish.direct` | Whether clients may address other clients directly |
|
|
65
65
|
| `delivery.guarantee` | The example uses `at_most_once`; delivery may be lost |
|
|
66
66
|
|
|
67
|
+
Optional `description`, `docs` and `tags` document a channel; a pull writes each only when it is set.
|
|
68
|
+
|
|
67
69
|
A room path separates subscriptions; knowing a path is not authorization. Use access policy and a join trigger for restricted rooms.
|
|
68
70
|
|
|
69
71
|
### Message handler
|
|
@@ -371,7 +373,7 @@ xano workspace push --profile YOUR_PROFILE --workspace YOUR_WORKSPACE --branch Y
|
|
|
371
373
|
xano workspace pull --profile YOUR_PROFILE --workspace YOUR_WORKSPACE --branch YOUR_BRANCH --directory pulled-workspace
|
|
372
374
|
```
|
|
373
375
|
|
|
374
|
-
Validate with `xano_validate_xanoscript` before pushing. Pull back and verify server canonicals, channel settings, message parent references, and trigger inputs. Use a current CLI release with Realtime V2 support. V2 objects
|
|
376
|
+
Validate with `xano_validate_xanoscript` before pushing. Pull back and verify server canonicals, channel settings, message parent references, and trigger inputs. Use a current CLI release with Realtime V2 support. The CLI pulls V2 objects under `realtime/server/<server>/`: the server's own file, `trigger/` for its triggers, and `channel/<channel>/` holding the channel file, `message/` and `trigger/`. Push reads the documents, not the folders, so a hand-made layout such as this example's flat `realtime_server/`, `channel/` and `message/` folders also works. Keep explicit parent clauses: folder names do not replace them.
|
|
375
377
|
|
|
376
378
|
If working from the source repository, run `node examples/realtime-v2/verify.mjs` with the frontend config pointed at your deployed examples. Set `XANO_TEST_USER_TOKEN` to an application user JWT to include the authenticated positive test. The script reports that test as skipped if the token is absent.
|
|
377
379
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
applyTo: "ai/resource/*.xs"
|
|
2
|
+
applyTo: "ai/resource/*.xs, resource/**/*.xs"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Resources
|
|
@@ -96,6 +96,8 @@ Reading `orders://eu/42` binds `region = "eu"` and `order_id = 42`, converted to
|
|
|
96
96
|
|
|
97
97
|
The declaration name (`resource regional_order`) is the resource's name. It is never its uri.
|
|
98
98
|
|
|
99
|
+
Without its own `middleware` block, a resource reached through an MCP server uses that server's middleware, as a tool does. Past the server it uses the branch's `resource` middleware (see `branch`). Without its own `history` setting, it follows the server's history override, then the branch's `resource` history setting.
|
|
100
|
+
|
|
99
101
|
---
|
|
100
102
|
|
|
101
103
|
## URI Rules
|
|
@@ -158,4 +158,4 @@ input {
|
|
|
158
158
|
|
|
159
159
|
### Available Topics
|
|
160
160
|
|
|
161
|
-
survival, working, readme, essentials, syntax, syntax/string-filters, syntax/array-filters, syntax/functions, types, database, functions, apis, tables, tasks, triggers, agents, tools, mcp-servers, security, performance, debugging, unit-testing, workflow-tests, middleware, addons, realtime, streaming, schema, integrations, integrations/cloud-storage, integrations/search, integrations/redis, integrations/external-apis, integrations/utilities, workspace, branch, run, frontend
|
|
161
|
+
survival, working, readme, essentials, syntax, syntax/string-filters, syntax/array-filters, syntax/functions, types, database, functions, apis, tables, tasks, triggers, agents, tools, mcp-servers, prompts, resources, security, performance, debugging, unit-testing, workflow-tests, middleware, addons, realtime, realtime-v2, streaming, schema, integrations, integrations/cloud-storage, integrations/search, integrations/redis, integrations/external-apis, integrations/utilities, workspace, branch, run, frontend
|
|
@@ -113,6 +113,20 @@ schema {
|
|
|
113
113
|
}
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
### Quoted Names
|
|
117
|
+
|
|
118
|
+
A column name that is not an identifier is written quoted, as a pull writes it:
|
|
119
|
+
|
|
120
|
+
```xs
|
|
121
|
+
schema {
|
|
122
|
+
int id
|
|
123
|
+
text "my-col"
|
|
124
|
+
timestamp "created-at"?=now
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Prefer identifier names (`created_at`) for new columns.
|
|
129
|
+
|
|
116
130
|
### Foreign Keys
|
|
117
131
|
|
|
118
132
|
```xs
|
|
@@ -243,6 +257,50 @@ Required for vector similarity searches via `cosine_distance` in `db.query`. Pos
|
|
|
243
257
|
|
|
244
258
|
---
|
|
245
259
|
|
|
260
|
+
## Views
|
|
261
|
+
|
|
262
|
+
Saved views of the table's data in Studio. Each key is the view name; each view needs an `id` and at least one of `term`, `search`, `sort` or `hide`. A pull writes `alias`, `term`, `search`, `sort` and `hide` only when the view has them.
|
|
263
|
+
|
|
264
|
+
```xs
|
|
265
|
+
table "customer" {
|
|
266
|
+
auth = false
|
|
267
|
+
schema {
|
|
268
|
+
int id
|
|
269
|
+
text name
|
|
270
|
+
email email
|
|
271
|
+
text notes?
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
index = [
|
|
275
|
+
{type: "primary", field: [{name: "id"}]}
|
|
276
|
+
]
|
|
277
|
+
|
|
278
|
+
view = {
|
|
279
|
+
"Gmail customers": {
|
|
280
|
+
term: "gmail"
|
|
281
|
+
sort: {id: "desc"}
|
|
282
|
+
id: "9ed7daad-682f-455e-bf02-ca53444cd429"
|
|
283
|
+
}
|
|
284
|
+
"Without notes": {
|
|
285
|
+
alias: "Contact columns"
|
|
286
|
+
hide: ["notes"]
|
|
287
|
+
id: "4c1f6e0a-2b7d-4f39-9a51-3e8d2c7b6a10"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
| Key | Description |
|
|
294
|
+
|-----|-------------|
|
|
295
|
+
| `id` | View id (required) |
|
|
296
|
+
| `alias` | Display name |
|
|
297
|
+
| `term` | Quick-search text |
|
|
298
|
+
| `search` | Filter expression |
|
|
299
|
+
| `sort` | `{field: "asc" \| "desc" \| "rand"}` |
|
|
300
|
+
| `hide` | Columns hidden in the view |
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
246
304
|
## Complete Examples
|
|
247
305
|
|
|
248
306
|
### User Table (with auth)
|
|
@@ -129,7 +129,7 @@ tool lookup_order {
|
|
|
129
129
|
|
|
130
130
|
### `title`
|
|
131
131
|
|
|
132
|
-
A human readable name, e.g. `"Look up an order"`. The tool name stays the identifier.
|
|
132
|
+
A human readable name, e.g. `"Look up an order"`. The tool name stays the identifier. A pull writes a title containing `"` as `'...'` and one containing a newline as a `"""` block; both are valid, as on prompts and resources.
|
|
133
133
|
|
|
134
134
|
### `annotations`
|
|
135
135
|
|
|
@@ -4,9 +4,9 @@ applyTo: "*/trigger/*.xs, ai/*/trigger/*.xs, realtime/trigger/*.xs"
|
|
|
4
4
|
|
|
5
5
|
# Triggers
|
|
6
6
|
|
|
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,
|
|
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, MCP server tool calls, and captured errors.
|
|
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.
|
|
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), `error_trigger` (error signature events). Each has predefined input blocks.
|
|
10
10
|
|
|
11
11
|
## Section Index
|
|
12
12
|
|
|
@@ -19,6 +19,7 @@ Event-driven handlers that execute in response to system events. Triggers allow
|
|
|
19
19
|
| [Workspace Trigger](#workspace-trigger) | Branch lifecycle event handlers |
|
|
20
20
|
| [Agent Trigger](#agent-trigger) | AI agent event handlers |
|
|
21
21
|
| [MCP Server Trigger](#mcp-server-trigger) | MCP tool call handlers |
|
|
22
|
+
| [Error Trigger](#error-trigger) | Captured error event handlers |
|
|
22
23
|
| [Common Patterns](#common-patterns) | Error handling, conditional logic |
|
|
23
24
|
| [Best Practices](#best-practices) | Guidelines for trigger development |
|
|
24
25
|
|
|
@@ -31,6 +32,7 @@ Event-driven handlers that execute in response to system events. Triggers allow
|
|
|
31
32
|
| `workspace_trigger` | React to branch lifecycle events | `input`, `stack` |
|
|
32
33
|
| `agent_trigger` | Handle AI agent connections | `agent`, `input`, `stack`, `response` |
|
|
33
34
|
| `mcp_server_trigger` | Handle MCP server tool calls | `mcp_server`, `input`, `stack`, `response` |
|
|
35
|
+
| `error_trigger` | React to new, regressed and fixed errors | `input`, `stack` |
|
|
34
36
|
|
|
35
37
|
---
|
|
36
38
|
|
|
@@ -555,7 +557,9 @@ mcp_server_trigger "<name>" {
|
|
|
555
557
|
|
|
556
558
|
| Action | Description |
|
|
557
559
|
|--------|-------------|
|
|
558
|
-
| `connection` | Trigger on MCP connection events
|
|
560
|
+
| `connection` | Trigger on MCP connection events |
|
|
561
|
+
|
|
562
|
+
A pull writes only the actions that are on, so a trigger with connection off is written `actions = {}`.
|
|
559
563
|
|
|
560
564
|
### Example
|
|
561
565
|
|
|
@@ -589,6 +593,132 @@ mcp_server_trigger "database_tool_handler" {
|
|
|
589
593
|
|
|
590
594
|
---
|
|
591
595
|
|
|
596
|
+
## Error Trigger
|
|
597
|
+
|
|
598
|
+
Runs when the workspace's error log records an error signature event. `active = false` pauses it; a pull writes `active` only when the trigger is paused.
|
|
599
|
+
|
|
600
|
+
### Syntax
|
|
601
|
+
|
|
602
|
+
```xs
|
|
603
|
+
error_trigger "<name>" {
|
|
604
|
+
description = "Description of this trigger"
|
|
605
|
+
active = false
|
|
606
|
+
|
|
607
|
+
// Uses the predefined error trigger input - see the Example
|
|
608
|
+
input { ... }
|
|
609
|
+
|
|
610
|
+
stack {
|
|
611
|
+
// Logic to execute when triggered
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
tags = ["tag1", "tag2"]
|
|
615
|
+
history = false
|
|
616
|
+
}
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
### Required Clauses
|
|
620
|
+
|
|
621
|
+
| Clause | Description |
|
|
622
|
+
|--------|-------------|
|
|
623
|
+
| `input` | Predefined input block (read-only) |
|
|
624
|
+
| `stack` | Logic to execute when triggered |
|
|
625
|
+
|
|
626
|
+
### Optional Clauses
|
|
627
|
+
|
|
628
|
+
| Clause | Type | Description |
|
|
629
|
+
|--------|------|-------------|
|
|
630
|
+
| `active` | boolean | `false` pauses the trigger (default `true`) |
|
|
631
|
+
| `description` | string | Short description |
|
|
632
|
+
| `history` | integer/string/boolean | History retention setting |
|
|
633
|
+
| `tags` | array | Tags for organization |
|
|
634
|
+
|
|
635
|
+
### Events
|
|
636
|
+
|
|
637
|
+
| `$input.event` | Fires when |
|
|
638
|
+
|----------------|------------|
|
|
639
|
+
| `new` | A signature is first captured, and again on each snapshot re-capture (about every 5 minutes) unless the signature is ignored |
|
|
640
|
+
| `regression` | A signature marked fixed occurs again |
|
|
641
|
+
| `fixed` | A user marks a signature fixed (`caller` and `statement` are null; `actor` is set) |
|
|
642
|
+
|
|
643
|
+
### Example
|
|
644
|
+
|
|
645
|
+
A paused trigger; delete `active = false` to turn it on. The input block is the one a pull writes, with descriptions omitted.
|
|
646
|
+
|
|
647
|
+
```xs
|
|
648
|
+
error_trigger "notify_on_error" {
|
|
649
|
+
description = "Post new and regressed errors to the team channel"
|
|
650
|
+
|
|
651
|
+
active = false
|
|
652
|
+
|
|
653
|
+
input {
|
|
654
|
+
enum event {
|
|
655
|
+
values = ["new", "regression", "fixed"]
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
int id
|
|
659
|
+
text signature
|
|
660
|
+
object error {
|
|
661
|
+
schema {
|
|
662
|
+
text code
|
|
663
|
+
text message
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
object? caller {
|
|
668
|
+
schema {
|
|
669
|
+
text type
|
|
670
|
+
int id
|
|
671
|
+
text? name
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
object? statement {
|
|
676
|
+
schema {
|
|
677
|
+
text name
|
|
678
|
+
text xsid
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
object? actor {
|
|
683
|
+
schema {
|
|
684
|
+
int id
|
|
685
|
+
text? name
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
object count {
|
|
690
|
+
schema {
|
|
691
|
+
int total
|
|
692
|
+
int last_hour
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
text first_seen
|
|
697
|
+
text last_seen
|
|
698
|
+
text? fixed_at
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
stack {
|
|
702
|
+
conditional {
|
|
703
|
+
if ($input.event != "fixed") {
|
|
704
|
+
api.request {
|
|
705
|
+
url = $env.SLACK_WEBHOOK_URL
|
|
706
|
+
method = "POST"
|
|
707
|
+
params = {text: $input.event ~ ": " ~ $input.error.message ~ " (" ~ $input.count.total ~ " total)"}
|
|
708
|
+
} as $notify
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
tags = ["alerts"]
|
|
714
|
+
history = false
|
|
715
|
+
}
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
`caller.type` is `api`, `function`, `task`, `middleware`, `trigger` or `unknown`. `id` is the error signature's id, `first_seen`, `last_seen` and `fixed_at` are ISO-8601 UTC timestamps.
|
|
719
|
+
|
|
720
|
+
---
|
|
721
|
+
|
|
592
722
|
## Best Practices
|
|
593
723
|
|
|
594
724
|
1. **Use predefined input blocks as-is** - Each trigger type has a read-only input block that cannot be modified
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
applyTo: "function/**/*.xs, api/**/*.xs, ai/tool/*.xs, ai/agent/*.xs, ai/prompt/*.xs, ai/resource/*.xs"
|
|
2
|
+
applyTo: "function/**/*.xs, api/**/*.xs, ai/tool/*.xs, ai/agent/*.xs, ai/prompt/*.xs, ai/resource/*.xs, prompt/**/*.xs, resource/**/*.xs"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Types & Inputs
|
|
@@ -100,6 +100,19 @@ input { email email_input? filters=trim|lower text name }
|
|
|
100
100
|
|
|
101
101
|
Access inputs in stack: `$input.username`, `$input.age`
|
|
102
102
|
|
|
103
|
+
### Quoted Names
|
|
104
|
+
|
|
105
|
+
A name that is not an identifier is written quoted, as a pull writes it. Read it with brackets:
|
|
106
|
+
|
|
107
|
+
```xs
|
|
108
|
+
input {
|
|
109
|
+
text "my-col"
|
|
110
|
+
timestamp "created-at"?=now
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Access: `$input["my-col"]`, `$input["created-at"]`. Prefer identifier names for new inputs.
|
|
115
|
+
|
|
103
116
|
---
|
|
104
117
|
|
|
105
118
|
## Type Details
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
applyTo: "function/**/*.xs, api/**/*.xs, middleware/*.xs"
|
|
2
|
+
applyTo: "function/**/*.xs, api/**/*.xs, middleware/*.xs, ai/tool/*.xs, ai/prompt/*.xs, prompt/**/*.xs, ai/resource/*.xs, resource/**/*.xs"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Unit Testing
|
|
6
6
|
|
|
7
|
-
Unit tests, mocks, and assertions defined inline within functions, API endpoints, and
|
|
7
|
+
Unit tests, mocks, and assertions defined inline within functions, API endpoints, middleware, and MCP tools, prompts and resources. Unit tests validate individual construct behavior in isolation — for end-to-end workflow testing across multiple constructs, see `workflow-tests`.
|
|
8
8
|
|
|
9
9
|
## Quick Reference
|
|
10
10
|
|
|
@@ -275,6 +275,33 @@ query "products/{id}" verb=GET {
|
|
|
275
275
|
|
|
276
276
|
---
|
|
277
277
|
|
|
278
|
+
## Testing MCP Tools, Prompts and Resources
|
|
279
|
+
|
|
280
|
+
A `tool`, `prompt` or `resource` takes `test` blocks the same way. The test's `input` fills the declaration's inputs, and `$response` is its `response` value.
|
|
281
|
+
|
|
282
|
+
```xs
|
|
283
|
+
prompt "summarize" {
|
|
284
|
+
input {
|
|
285
|
+
text doc
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
stack {
|
|
289
|
+
var $messages {
|
|
290
|
+
value = [{role: "user", content: "Summarize: " ~ $input.doc}]
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
response = $messages
|
|
295
|
+
|
|
296
|
+
test "builds one user message" {
|
|
297
|
+
input = { doc: "hello" }
|
|
298
|
+
expect.to_not_equal ($response) { value = null }
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
278
305
|
## Testing Error Cases
|
|
279
306
|
|
|
280
307
|
```xs
|
|
@@ -39,6 +39,7 @@ Call functions invoke Xano constructs and capture their results. Each returns a
|
|
|
39
39
|
| `task.call` | Call a task | — |
|
|
40
40
|
| `tool.call` | Call a tool | — |
|
|
41
41
|
| `trigger.call` | Call a trigger | `input` with `new`, `old`, `action`, `datasource` |
|
|
42
|
+
| `workflow_test.call` | Run another workflow test | optional `datasource` |
|
|
42
43
|
|
|
43
44
|
### api.call
|
|
44
45
|
|
|
@@ -93,6 +94,20 @@ trigger.call "<trigger_name>" {
|
|
|
93
94
|
} as $result
|
|
94
95
|
```
|
|
95
96
|
|
|
97
|
+
### workflow_test.call
|
|
98
|
+
|
|
99
|
+
Runs another workflow test as a step. Valid only inside a `workflow_test`.
|
|
100
|
+
|
|
101
|
+
```xs
|
|
102
|
+
workflow_test.call "<workflow_test_name>" {
|
|
103
|
+
datasource = "staging"
|
|
104
|
+
} as $result
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- The call binds the target's outcome instead of raising it: `null` when the target passes, `{code, message}` when it fails. Assert on the binding, or wrap the call in `expect.to_throw` to require a failure.
|
|
108
|
+
- `datasource` is optional; a pull writes it only when set. The common statement attributes `description`, `disabled` and `mock` are also accepted.
|
|
109
|
+
- A test cannot call itself or a test already running earlier in the chain (the call fails with `already running earlier in this chain`), and the call is refused inside a `db.transaction`.
|
|
110
|
+
|
|
96
111
|
---
|
|
97
112
|
|
|
98
113
|
## Assertions
|
|
@@ -249,6 +264,9 @@ workflow_test "comprehensive_test" {
|
|
|
249
264
|
input = {new: {}, old: {}, action: "", datasource: ""}
|
|
250
265
|
} as $trigger1
|
|
251
266
|
|
|
267
|
+
workflow_test.call "my_other_test" as $chained1
|
|
268
|
+
expect.to_be_null ($chained1)
|
|
269
|
+
|
|
252
270
|
// No-property assertions
|
|
253
271
|
expect.to_be_defined ($endpoint1)
|
|
254
272
|
expect.to_be_empty ($addon1)
|
|
@@ -128,14 +128,7 @@ throw {
|
|
|
128
128
|
var $obj { value = { name: "Alice", age: 30 } }
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
-
### 10. Using
|
|
132
|
-
```xs
|
|
133
|
-
// WRONG: run.job "my_job" { input { text api_key = $env.API_KEY } }
|
|
134
|
-
// RIGHT — access $env in the stack:
|
|
135
|
-
run.job "my_job" { stack { var $api_key { value = $env.API_KEY } } }
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 11. Using `object` type without schema
|
|
131
|
+
### 10. Using `object` type without schema
|
|
139
132
|
```xs
|
|
140
133
|
// WRONG: input { object data }
|
|
141
134
|
// RIGHT — use json for arbitrary data:
|
|
@@ -144,14 +137,14 @@ input { json data }
|
|
|
144
137
|
input { object data { schema { text name int id } } }
|
|
145
138
|
```
|
|
146
139
|
|
|
147
|
-
###
|
|
140
|
+
### 11. While loop outside of stack block
|
|
148
141
|
```xs
|
|
149
142
|
// WRONG: while (true) { each { ... } }
|
|
150
143
|
// RIGHT:
|
|
151
144
|
stack { while (true) { each { ... } } }
|
|
152
145
|
```
|
|
153
146
|
|
|
154
|
-
###
|
|
147
|
+
### 12. Multiple constructs in one file
|
|
155
148
|
```
|
|
156
149
|
// WRONG — two constructs in one file:
|
|
157
150
|
// function "helper_a" { ... }
|
|
@@ -622,6 +615,41 @@ api.request {
|
|
|
622
615
|
|
|
623
616
|
---
|
|
624
617
|
|
|
618
|
+
## AI Statements (Xano AI)
|
|
619
|
+
|
|
620
|
+
```
|
|
621
|
+
One-shot model call → ai.text.generate | ai.image.generate | ai.video.generate | ai.speech.generate
|
|
622
|
+
ai.speech.transcribe | ai.embedding.create | ai.rerank | ai.music.generate
|
|
623
|
+
Tools / multi-step → ai.agent.run
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
```xs
|
|
627
|
+
// Xano AI credits only: no api_key/provider key. Fails with credits_exhausted when credits run out.
|
|
628
|
+
ai.text.generate {
|
|
629
|
+
model = "gemini-3.8-flash"
|
|
630
|
+
prompt = $input.question
|
|
631
|
+
} as $result
|
|
632
|
+
|
|
633
|
+
// Media comes back as a temporary file resource and is NOT stored automatically.
|
|
634
|
+
// A file resource in a file column saves null: store it first. Either set
|
|
635
|
+
// save_to_files = "public" on the media statement ($gen.image is then the stored
|
|
636
|
+
// file, not a file resource), or use the From File statement (storage.create_image / create_video / create_audio):
|
|
637
|
+
ai.image.generate {
|
|
638
|
+
model = "gemini-3.1-flash-image"
|
|
639
|
+
prompt = "A red fox, watercolor"
|
|
640
|
+
} as $gen
|
|
641
|
+
|
|
642
|
+
storage.create_image {
|
|
643
|
+
value = $gen.image
|
|
644
|
+
access = "public"
|
|
645
|
+
filename = "fox.png"
|
|
646
|
+
} as $stored
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
> Keys, defaults, output shapes and the model table: `xano_xanoscript_docs({ topic: "ai" })`
|
|
650
|
+
|
|
651
|
+
---
|
|
652
|
+
|
|
625
653
|
## Common Patterns
|
|
626
654
|
|
|
627
655
|
### Authentication Check
|
|
@@ -666,6 +694,7 @@ var $msg { value = ($status|to_text) ~ ": " ~ ($data|json_encode) }
|
|
|
666
694
|
| `tables` | Database schema definitions | ~7KB |
|
|
667
695
|
| `tasks` | Scheduled/cron jobs | ~6KB |
|
|
668
696
|
| `triggers` | Event handlers (table, realtime, agent, MCP) | ~17KB |
|
|
697
|
+
| `ai` | Xano AI statements (ai.text.generate, ai.image.generate, ...) | ~14KB |
|
|
669
698
|
| `agents` | AI agent configuration | ~9KB |
|
|
670
699
|
| `tools` | AI tools for agents | ~7KB |
|
|
671
700
|
| `mcp-servers` | MCP server definitions | ~4KB |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xano/developer-mcp",
|
|
3
|
-
"version": "2.3.0-beta.
|
|
3
|
+
"version": "2.3.0-beta.10",
|
|
4
4
|
"description": "MCP server and library for Xano development - XanoScript validation, Meta API, Run API, and CLI documentation",
|
|
5
5
|
"mcpName": "io.github.xano-inc/xano-developer-mcp",
|
|
6
6
|
"type": "module",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"license": "MIT",
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
65
|
-
"@xano/xanoscript-language-server": "^12.
|
|
65
|
+
"@xano/xanoscript-language-server": "^12.31.0",
|
|
66
66
|
"minimatch": "^10.1.2",
|
|
67
67
|
"zod": "^4.0.0"
|
|
68
68
|
},
|