@xano/developer-mcp 2.3.0-beta.1 → 2.3.0-beta.11
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 +4 -14
- package/dist/cli_docs/index.js +0 -4
- package/dist/cli_docs/topics/function.js +0 -2
- package/dist/cli_docs/topics/knowledge.js +1 -2
- package/dist/cli_docs/topics/workspace.js +23 -12
- package/dist/meta_api_docs/format.js +15 -2
- package/dist/meta_api_docs/index.js +0 -2
- package/dist/meta_api_docs/topics/agent.js +36 -24
- package/dist/meta_api_docs/topics/api.js +50 -43
- 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/function.js +26 -25
- package/dist/meta_api_docs/topics/history.js +42 -11
- package/dist/meta_api_docs/topics/mcp_server.js +23 -28
- package/dist/meta_api_docs/topics/middleware.js +36 -32
- package/dist/meta_api_docs/topics/table.js +43 -22
- package/dist/meta_api_docs/topics/task.js +40 -40
- package/dist/meta_api_docs/topics/tool.js +39 -26
- package/dist/meta_api_docs/topics/workflows.js +84 -28
- package/dist/meta_api_docs/topics/workspace.js +1 -1
- package/dist/tools/validate_xanoscript.js +6 -9
- package/dist/xanoscript.js +0 -1
- package/dist/xanoscript_docs/README.md +25 -8
- 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 +7 -5
- package/dist/xanoscript_docs/docs_index.json +36 -22
- 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 -5
- 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 -15
- package/package.json +2 -3
- package/dist/cli_docs/topics/policy.d.ts +0 -2
- package/dist/cli_docs/topics/policy.js +0 -91
- package/dist/cli_docs/topics/skills.d.ts +0 -2
- package/dist/cli_docs/topics/skills.js +0 -57
- package/dist/meta_api_docs/topics/policy.d.ts +0 -3
- package/dist/meta_api_docs/topics/policy.js +0 -135
- package/dist/xanoscript_docs/policies.md +0 -308
|
@@ -20,10 +20,12 @@ branch "<name>" {
|
|
|
20
20
|
### Attributes
|
|
21
21
|
| Attribute | Type | Required | Description |
|
|
22
22
|
|-----------|------|----------|-------------|
|
|
23
|
-
| `color` | text |
|
|
23
|
+
| `color` | text | No | Hex color code for branch identification (a pull omits it when unset) |
|
|
24
24
|
| `description` | text | No | Human-readable branch description |
|
|
25
|
-
| `middleware` | object |
|
|
26
|
-
| `history` | object |
|
|
25
|
+
| `middleware` | object | Yes | Pre/post middleware; `function`, `query`, `task` and `tool` are required |
|
|
26
|
+
| `history` | object | Yes | Trace retention; `function`, `query`, `task`, `tool`, `trigger` and `middleware` are required |
|
|
27
|
+
|
|
28
|
+
A pull always writes both `middleware` and `history`, so a branch file needs them even when every list is empty.
|
|
27
29
|
|
|
28
30
|
---
|
|
29
31
|
|
|
@@ -33,6 +35,23 @@ branch "<name>" {
|
|
|
33
35
|
branch "production" {
|
|
34
36
|
color = "#22c55e"
|
|
35
37
|
description = "Production environment"
|
|
38
|
+
|
|
39
|
+
middleware = {
|
|
40
|
+
function: {pre: [], post: []},
|
|
41
|
+
query: {pre: [], post: []},
|
|
42
|
+
task: {pre: [], post: []},
|
|
43
|
+
tool: {pre: [], post: []},
|
|
44
|
+
message: {pre: [], post: []}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
history = {
|
|
48
|
+
function: 100,
|
|
49
|
+
query: 100,
|
|
50
|
+
task: 100,
|
|
51
|
+
tool: 100,
|
|
52
|
+
trigger: 100,
|
|
53
|
+
middleware: 100
|
|
54
|
+
}
|
|
36
55
|
}
|
|
37
56
|
```
|
|
38
57
|
|
|
@@ -40,7 +59,7 @@ branch "production" {
|
|
|
40
59
|
|
|
41
60
|
## Middleware Configuration
|
|
42
61
|
|
|
43
|
-
Configure middleware to run before (pre) and after (post) different construct types.
|
|
62
|
+
Configure middleware to run before (pre) and after (post) different construct types. Each entry is an object naming a middleware: `{name: "auth_check"}`. Add `active: false` to keep an entry in place but skip it. A list of plain strings is not accepted.
|
|
44
63
|
|
|
45
64
|
### Syntax
|
|
46
65
|
|
|
@@ -50,22 +69,43 @@ branch "production" {
|
|
|
50
69
|
|
|
51
70
|
middleware = {
|
|
52
71
|
function: {
|
|
53
|
-
pre: ["auth_check", "rate_limit"],
|
|
54
|
-
post: ["audit_log"]
|
|
72
|
+
pre: [{name: "auth_check"}, {name: "rate_limit"}],
|
|
73
|
+
post: [{name: "audit_log"}]
|
|
55
74
|
},
|
|
56
75
|
query: {
|
|
57
|
-
pre: ["auth_check", "rate_limit"],
|
|
58
|
-
post: ["audit_log", "cache_response"]
|
|
76
|
+
pre: [{name: "auth_check"}, {name: "rate_limit"}],
|
|
77
|
+
post: [{name: "audit_log"}, {name: "cache_response", active: false}]
|
|
59
78
|
},
|
|
60
79
|
task: {
|
|
61
|
-
pre: ["task_lock"],
|
|
62
|
-
post: ["task_cleanup"]
|
|
80
|
+
pre: [{name: "task_lock"}],
|
|
81
|
+
post: [{name: "task_cleanup"}]
|
|
63
82
|
},
|
|
64
83
|
tool: {
|
|
65
|
-
pre: ["tool_auth"],
|
|
66
|
-
post: ["tool_log"]
|
|
84
|
+
pre: [{name: "tool_auth"}],
|
|
85
|
+
post: [{name: "tool_log"}]
|
|
86
|
+
},
|
|
87
|
+
message: {
|
|
88
|
+
pre: [{name: "auth_check"}],
|
|
89
|
+
post: []
|
|
90
|
+
},
|
|
91
|
+
prompt: {
|
|
92
|
+
pre: [{name: "tool_auth"}],
|
|
93
|
+
post: []
|
|
94
|
+
},
|
|
95
|
+
resource: {
|
|
96
|
+
pre: [{name: "tool_auth"}],
|
|
97
|
+
post: []
|
|
67
98
|
}
|
|
68
99
|
}
|
|
100
|
+
|
|
101
|
+
history = {
|
|
102
|
+
function: 100,
|
|
103
|
+
query: 100,
|
|
104
|
+
task: 100,
|
|
105
|
+
tool: 100,
|
|
106
|
+
trigger: 100,
|
|
107
|
+
middleware: 100
|
|
108
|
+
}
|
|
69
109
|
}
|
|
70
110
|
```
|
|
71
111
|
|
|
@@ -73,10 +113,15 @@ branch "production" {
|
|
|
73
113
|
|
|
74
114
|
| Target | Description |
|
|
75
115
|
|--------|-------------|
|
|
76
|
-
| `function` | Applies to all function calls |
|
|
77
|
-
| `query` | Applies to all API endpoints |
|
|
78
|
-
| `task` | Applies to scheduled tasks |
|
|
79
|
-
| `tool` | Applies to AI agent tools |
|
|
116
|
+
| `function` | Applies to all function calls (required) |
|
|
117
|
+
| `query` | Applies to all API endpoints (required) |
|
|
118
|
+
| `task` | Applies to scheduled tasks (required) |
|
|
119
|
+
| `tool` | Applies to AI agent and MCP tools (required) |
|
|
120
|
+
| `message` | Applies to realtime messages |
|
|
121
|
+
| `prompt` | Applies to MCP prompts (optional) |
|
|
122
|
+
| `resource` | Applies to MCP resources (optional) |
|
|
123
|
+
|
|
124
|
+
A pull writes the `prompt` and `resource` lines only when the branch has middleware for them. A missing target means no branch middleware for that type.
|
|
80
125
|
|
|
81
126
|
### Pre vs Post Middleware
|
|
82
127
|
|
|
@@ -85,11 +130,22 @@ branch "production" {
|
|
|
85
130
|
| `pre` | Before main logic | Authentication, rate limiting, validation |
|
|
86
131
|
| `post` | After main logic | Logging, caching, response transformation |
|
|
87
132
|
|
|
133
|
+
### Which Middleware Runs
|
|
134
|
+
|
|
135
|
+
Pre and post are resolved separately. The first level that sets its own list wins, even if that list is empty:
|
|
136
|
+
|
|
137
|
+
1. The object's own `middleware` block
|
|
138
|
+
2. Its container: the API group for a query; the MCP server a tool, prompt or resource was reached through; the channel, then its realtime server, for a message
|
|
139
|
+
3. The branch's list for that type (`query`, `prompt`, ...)
|
|
140
|
+
4. The workspace's list, only when the object's branch cannot be resolved
|
|
141
|
+
|
|
142
|
+
Entries with `active: false` are skipped.
|
|
143
|
+
|
|
88
144
|
---
|
|
89
145
|
|
|
90
146
|
## History Configuration
|
|
91
147
|
|
|
92
|
-
Control how many statements from the execution trace are retained per request. Execution traces are kept for 24 hours; this setting limits how many stack statements are recorded in each trace.
|
|
148
|
+
Control how many statements from the execution trace are retained per request. `function`, `query`, `task`, `tool`, `trigger` and `middleware` are required. Execution traces are kept for 24 hours; this setting limits how many stack statements are recorded in each trace.
|
|
93
149
|
|
|
94
150
|
### Syntax
|
|
95
151
|
|
|
@@ -97,13 +153,22 @@ Control how many statements from the execution trace are retained per request. E
|
|
|
97
153
|
branch "production" {
|
|
98
154
|
color = "#22c55e"
|
|
99
155
|
|
|
156
|
+
middleware = {
|
|
157
|
+
function: {pre: [], post: []},
|
|
158
|
+
query: {pre: [], post: []},
|
|
159
|
+
task: {pre: [], post: []},
|
|
160
|
+
tool: {pre: [], post: []}
|
|
161
|
+
}
|
|
162
|
+
|
|
100
163
|
history = {
|
|
101
164
|
function: 100,
|
|
102
165
|
query: 1000,
|
|
103
166
|
task: 100,
|
|
104
167
|
tool: 100,
|
|
105
168
|
trigger: 100,
|
|
106
|
-
middleware: 10
|
|
169
|
+
middleware: 10,
|
|
170
|
+
prompt: 100,
|
|
171
|
+
resource: false
|
|
107
172
|
}
|
|
108
173
|
}
|
|
109
174
|
```
|
|
@@ -113,6 +178,7 @@ branch "production" {
|
|
|
113
178
|
| Value | Description |
|
|
114
179
|
|-------|-------------|
|
|
115
180
|
| `false` | Disable history (no statements recorded) |
|
|
181
|
+
| `0` | Record no statements (a pull writes `task: 0` when task history is off) |
|
|
116
182
|
| `10` | Record up to 10 statements per trace |
|
|
117
183
|
| `100` | Record up to 100 statements per trace |
|
|
118
184
|
| `1000` | Record up to 1000 statements per trace |
|
|
@@ -129,6 +195,10 @@ branch "production" {
|
|
|
129
195
|
| `tool` | Statement limit for AI tool traces |
|
|
130
196
|
| `trigger` | Statement limit for trigger traces |
|
|
131
197
|
| `middleware` | Statement limit for middleware traces |
|
|
198
|
+
| `prompt` | Statement limit for MCP prompt traces (optional) |
|
|
199
|
+
| `resource` | Statement limit for MCP resource traces (optional) |
|
|
200
|
+
|
|
201
|
+
`prompt` and `resource` default to `100`. A pull writes them only when they differ from that default. An MCP server whose history settings do not inherit overrides the branch for its tools, prompts and resources.
|
|
132
202
|
|
|
133
203
|
---
|
|
134
204
|
|
|
@@ -141,6 +211,13 @@ branch "development" {
|
|
|
141
211
|
color = "#3b82f6"
|
|
142
212
|
description = "Development environment with full debugging"
|
|
143
213
|
|
|
214
|
+
middleware = {
|
|
215
|
+
function: {pre: [], post: []},
|
|
216
|
+
query: {pre: [], post: []},
|
|
217
|
+
task: {pre: [], post: []},
|
|
218
|
+
tool: {pre: [], post: []}
|
|
219
|
+
}
|
|
220
|
+
|
|
144
221
|
history = {
|
|
145
222
|
function: "all",
|
|
146
223
|
query: "all",
|
|
@@ -160,10 +237,13 @@ branch "staging" {
|
|
|
160
237
|
description = "Staging environment for testing"
|
|
161
238
|
|
|
162
239
|
middleware = {
|
|
240
|
+
function: {pre: [], post: []},
|
|
163
241
|
query: {
|
|
164
|
-
pre: ["auth_check"],
|
|
165
|
-
post: ["audit_log"]
|
|
166
|
-
}
|
|
242
|
+
pre: [{name: "auth_check"}],
|
|
243
|
+
post: [{name: "audit_log"}]
|
|
244
|
+
},
|
|
245
|
+
task: {pre: [], post: []},
|
|
246
|
+
tool: {pre: [], post: []}
|
|
167
247
|
}
|
|
168
248
|
|
|
169
249
|
history = {
|
|
@@ -186,20 +266,20 @@ branch "production" {
|
|
|
186
266
|
|
|
187
267
|
middleware = {
|
|
188
268
|
function: {
|
|
189
|
-
pre: ["auth_check", "rate_limit"],
|
|
190
|
-
post: ["audit_log"]
|
|
269
|
+
pre: [{name: "auth_check"}, {name: "rate_limit"}],
|
|
270
|
+
post: [{name: "audit_log"}]
|
|
191
271
|
},
|
|
192
272
|
query: {
|
|
193
|
-
pre: ["auth_check", "rate_limit", "security_check"],
|
|
194
|
-
post: ["audit_log", "cache_response"]
|
|
273
|
+
pre: [{name: "auth_check"}, {name: "rate_limit"}, {name: "security_check"}],
|
|
274
|
+
post: [{name: "audit_log"}, {name: "cache_response"}]
|
|
195
275
|
},
|
|
196
276
|
task: {
|
|
197
|
-
pre: ["task_lock"],
|
|
198
|
-
post: ["audit_log"]
|
|
277
|
+
pre: [{name: "task_lock"}],
|
|
278
|
+
post: [{name: "audit_log"}]
|
|
199
279
|
},
|
|
200
280
|
tool: {
|
|
201
|
-
pre: ["auth_check"],
|
|
202
|
-
post: ["audit_log"]
|
|
281
|
+
pre: [{name: "auth_check"}],
|
|
282
|
+
post: [{name: "audit_log"}]
|
|
203
283
|
}
|
|
204
284
|
}
|
|
205
285
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
applyTo: "function/**/*.xs, api/**/*.xs, task/*.xs, ai/tool/*.xs, ai/prompt/*.xs, ai/resource/*.xs"
|
|
2
|
+
applyTo: "function/**/*.xs, api/**/*.xs, task/*.xs, ai/tool/*.xs, ai/prompt/*.xs, ai/resource/*.xs, prompt/**/*.xs, resource/**/*.xs"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Database Operations
|
|
@@ -152,10 +152,7 @@ db.get "product" {
|
|
|
152
152
|
A dotted path selects a nested field (`"price.amount"`). `output` is valid on `db.query`,
|
|
153
153
|
`db.get`, `db.add`, `db.edit`, `db.patch` and `db.add_or_edit`; `db.has`, `db.del` and the
|
|
154
154
|
bulk statements do not take it. The bundled language server behind `xano_validate_xanoscript`
|
|
155
|
-
rejects it on `db.patch` and `db.add_or_edit`, which the platform accepts.
|
|
156
|
-
`statement.param_required` with `param_names: ["output"]` (and `statements: ["db.query",
|
|
157
|
-
"db.get"]`) is how a workspace requires it, so a finding reading `output must be explicit` is
|
|
158
|
-
asking for exactly this line.
|
|
155
|
+
rejects it on `db.patch` and `db.add_or_edit`, which the platform accepts.
|
|
159
156
|
|
|
160
157
|
### Sorting
|
|
161
158
|
|
|
@@ -288,6 +285,8 @@ db.add "product" {
|
|
|
288
285
|
} as $product
|
|
289
286
|
```
|
|
290
287
|
|
|
288
|
+
`data = {}` is valid on `db.add`, `db.edit` and `db.add_or_edit`; a pull writes it when the statement sets no fields.
|
|
289
|
+
|
|
291
290
|
---
|
|
292
291
|
|
|
293
292
|
## db.edit
|
|
@@ -507,6 +506,9 @@ db.external.mssql.direct_query { ... }
|
|
|
507
506
|
|
|
508
507
|
// Oracle
|
|
509
508
|
db.external.oracle.direct_query { ... }
|
|
509
|
+
|
|
510
|
+
// Snowflake
|
|
511
|
+
db.external.snowflake.direct_query { ... }
|
|
510
512
|
```
|
|
511
513
|
|
|
512
514
|
---
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.11.0",
|
|
3
3
|
"description": "Machine-readable index for XanoScript documentation (version mirrors version.json)",
|
|
4
4
|
|
|
5
5
|
"topics": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"types": {
|
|
72
72
|
"file": "types.md",
|
|
73
73
|
"description": "Data types, input blocks, and validation",
|
|
74
|
-
"applyTo": ["function/**/*.xs", "api/**/*.xs", "ai/tool/*.xs", "ai/agent/*.xs", "ai/prompt/*.xs", "ai/resource/*.xs"],
|
|
74
|
+
"applyTo": ["function/**/*.xs", "api/**/*.xs", "ai/tool/*.xs", "ai/agent/*.xs", "ai/prompt/*.xs", "ai/resource/*.xs", "prompt/**/*.xs", "resource/**/*.xs"],
|
|
75
75
|
"priority": 5,
|
|
76
76
|
"aliases": ["validation", "input", "data-types"]
|
|
77
77
|
},
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
},
|
|
106
106
|
"triggers": {
|
|
107
107
|
"file": "triggers.md",
|
|
108
|
-
"description": "Event-driven handlers (table, realtime, workspace, agent, MCP)",
|
|
108
|
+
"description": "Event-driven handlers (table, realtime, workspace, agent, MCP, error)",
|
|
109
109
|
"applyTo": ["*/trigger/*.xs", "ai/*/trigger/*.xs", "realtime/trigger/*.xs"],
|
|
110
110
|
"priority": 3,
|
|
111
111
|
"aliases": ["events", "hooks", "handlers"]
|
|
@@ -113,16 +113,23 @@
|
|
|
113
113
|
"database": {
|
|
114
114
|
"file": "database.md",
|
|
115
115
|
"description": "All db.* operations: query, get, add, edit, patch, increment, delete",
|
|
116
|
-
"applyTo": ["function/**/*.xs", "api/**/*.xs", "task/*.xs", "ai/tool/*.xs", "ai/prompt/*.xs", "ai/resource/*.xs"],
|
|
116
|
+
"applyTo": ["function/**/*.xs", "api/**/*.xs", "task/*.xs", "ai/tool/*.xs", "ai/prompt/*.xs", "ai/resource/*.xs", "prompt/**/*.xs", "resource/**/*.xs"],
|
|
117
117
|
"priority": 5,
|
|
118
118
|
"aliases": ["db", "crud", "query", "sql"]
|
|
119
119
|
},
|
|
120
|
+
"ai": {
|
|
121
|
+
"file": "ai.md",
|
|
122
|
+
"description": "Xano AI statements (credits only): ai.text.generate, ai.image.generate, ai.video.generate, ai.speech.generate, ai.speech.transcribe, ai.embedding.create, ai.rerank, ai.music.generate",
|
|
123
|
+
"applyTo": [],
|
|
124
|
+
"priority": 9,
|
|
125
|
+
"aliases": ["xano-ai", "ai-statements", "generate", "image-generation", "embeddings", "embedding", "rerank", "transcribe", "tts", "text-to-speech", "speech-to-text"]
|
|
126
|
+
},
|
|
120
127
|
"agents": {
|
|
121
128
|
"file": "agents.md",
|
|
122
129
|
"description": "AI agent configuration with LLM providers and tools",
|
|
123
130
|
"applyTo": ["ai/agent/*.xs"],
|
|
124
131
|
"priority": 3,
|
|
125
|
-
"aliases": ["
|
|
132
|
+
"aliases": ["agent", "llm", "chatbot"]
|
|
126
133
|
},
|
|
127
134
|
"tools": {
|
|
128
135
|
"file": "tools.md",
|
|
@@ -141,21 +148,21 @@
|
|
|
141
148
|
"prompts": {
|
|
142
149
|
"file": "prompts.md",
|
|
143
150
|
"description": "MCP prompts: reusable prompt templates an MCP server offers, with arguments and completions",
|
|
144
|
-
"applyTo": ["ai/prompt/*.xs"],
|
|
151
|
+
"applyTo": ["ai/prompt/*.xs", "prompt/**/*.xs"],
|
|
145
152
|
"priority": 3,
|
|
146
153
|
"aliases": ["prompt", "mcp-prompts"]
|
|
147
154
|
},
|
|
148
155
|
"resources": {
|
|
149
156
|
"file": "resources.md",
|
|
150
157
|
"description": "MCP resources: static and URI-template resources an MCP server shares as context",
|
|
151
|
-
"applyTo": ["ai/resource/*.xs"],
|
|
158
|
+
"applyTo": ["ai/resource/*.xs", "resource/**/*.xs"],
|
|
152
159
|
"priority": 3,
|
|
153
160
|
"aliases": ["resource", "mcp-resources", "resource-templates"]
|
|
154
161
|
},
|
|
155
162
|
"unit-testing": {
|
|
156
163
|
"file": "unit-testing.md",
|
|
157
|
-
"description": "Unit tests, mocks, and assertions within functions, APIs, and
|
|
158
|
-
"applyTo": ["function/**/*.xs", "api/**/*.xs", "middleware/*.xs"],
|
|
164
|
+
"description": "Unit tests, mocks, and assertions within functions, APIs, middleware, and MCP tools, prompts and resources",
|
|
165
|
+
"applyTo": ["function/**/*.xs", "api/**/*.xs", "middleware/*.xs", "ai/tool/*.xs", "ai/prompt/*.xs", "prompt/**/*.xs", "ai/resource/*.xs", "resource/**/*.xs"],
|
|
159
166
|
"priority": 7,
|
|
160
167
|
"aliases": ["tests", "unit-tests", "mocks", "assertions"]
|
|
161
168
|
},
|
|
@@ -258,7 +265,10 @@
|
|
|
258
265
|
"channel/**/*.xs",
|
|
259
266
|
"message/**/*.xs",
|
|
260
267
|
"channel_trigger/**/*.xs",
|
|
261
|
-
"realtime_server_trigger/**/*.xs"
|
|
268
|
+
"realtime_server_trigger/**/*.xs",
|
|
269
|
+
"realtime/server/**/*.xs",
|
|
270
|
+
"realtime/channel_trigger/*.xs",
|
|
271
|
+
"realtime/server_trigger/*.xs"
|
|
262
272
|
],
|
|
263
273
|
"priority": 3,
|
|
264
274
|
"aliases": [
|
|
@@ -302,14 +312,6 @@
|
|
|
302
312
|
"applyTo": ["workspace/**/*.xs"],
|
|
303
313
|
"priority": 3,
|
|
304
314
|
"aliases": ["env", "environment", "preferences"]
|
|
305
|
-
},
|
|
306
|
-
"policies": {
|
|
307
|
-
"file": "policies.md",
|
|
308
|
-
"description": "Workspace policies: human descriptions and deterministic check rules, validated by the platform",
|
|
309
|
-
"applyTo": ["policies/*.xs"],
|
|
310
|
-
"exclusive": true,
|
|
311
|
-
"priority": 3,
|
|
312
|
-
"aliases": ["policy", "governance"]
|
|
313
315
|
}
|
|
314
316
|
},
|
|
315
317
|
|
|
@@ -375,15 +377,16 @@
|
|
|
375
377
|
"api_group": { "file": "apis.md" },
|
|
376
378
|
"task": { "file": "tasks.md" },
|
|
377
379
|
"agent": { "file": "agents.md", "tools": "tools.md" },
|
|
378
|
-
"tool": { "file": "tools.md", "mcp": "mcp-servers.md" },
|
|
380
|
+
"tool": { "file": "tools.md", "mcp": "mcp-servers.md", "testing": "unit-testing.md" },
|
|
379
381
|
"mcp_server": { "file": "mcp-servers.md", "triggers": "triggers.md" },
|
|
380
|
-
"prompt": { "file": "prompts.md", "mcp": "mcp-servers.md" },
|
|
381
|
-
"resource": { "file": "resources.md", "mcp": "mcp-servers.md" },
|
|
382
|
+
"prompt": { "file": "prompts.md", "mcp": "mcp-servers.md", "testing": "unit-testing.md" },
|
|
383
|
+
"resource": { "file": "resources.md", "mcp": "mcp-servers.md", "testing": "unit-testing.md" },
|
|
382
384
|
"table_trigger": { "file": "triggers.md", "section": "table-trigger" },
|
|
383
385
|
"realtime_trigger": { "file": "triggers.md", "section": "realtime-trigger" },
|
|
384
386
|
"workspace_trigger": { "file": "triggers.md", "section": "workspace-trigger" },
|
|
385
387
|
"agent_trigger": { "file": "triggers.md", "section": "agent-trigger" },
|
|
386
388
|
"mcp_server_trigger": { "file": "triggers.md", "section": "mcp-server-trigger" },
|
|
389
|
+
"error_trigger": { "file": "triggers.md", "section": "error-trigger" },
|
|
387
390
|
"addon": { "file": "addons.md" },
|
|
388
391
|
"middleware": { "file": "middleware.md" },
|
|
389
392
|
"realtime_channel": { "file": "realtime.md" },
|
|
@@ -397,6 +400,15 @@
|
|
|
397
400
|
"operations": {
|
|
398
401
|
"realtime.publish": { "file": "realtime-v2.md" },
|
|
399
402
|
"realtime.get_session": { "file": "realtime-v2.md" },
|
|
403
|
+
"ai.agent.run": { "file": "agents.md" },
|
|
404
|
+
"ai.text.generate": { "file": "ai.md" },
|
|
405
|
+
"ai.image.generate": { "file": "ai.md" },
|
|
406
|
+
"ai.video.generate": { "file": "ai.md" },
|
|
407
|
+
"ai.speech.generate": { "file": "ai.md" },
|
|
408
|
+
"ai.speech.transcribe": { "file": "ai.md" },
|
|
409
|
+
"ai.embedding.create": { "file": "ai.md" },
|
|
410
|
+
"ai.rerank": { "file": "ai.md" },
|
|
411
|
+
"ai.music.generate": { "file": "ai.md" },
|
|
400
412
|
"mcp.elicit": { "file": "mcp-servers.md" },
|
|
401
413
|
"mcp.progress": { "file": "mcp-servers.md" },
|
|
402
414
|
"db.query": { "file": "database.md" },
|
|
@@ -502,6 +514,8 @@
|
|
|
502
514
|
"email": ["integrations/utilities.md"],
|
|
503
515
|
"scheduled_jobs": ["tasks.md"],
|
|
504
516
|
"realtime": ["realtime.md", "triggers.md"],
|
|
505
|
-
"ai_agents": ["agents.md", "tools.md", "mcp-servers.md"]
|
|
517
|
+
"ai_agents": ["agents.md", "tools.md", "mcp-servers.md"],
|
|
518
|
+
"ai_generation": ["ai.md", "file-uploads.md"],
|
|
519
|
+
"embeddings": ["ai.md", "database.md", "tables.md"]
|
|
506
520
|
}
|
|
507
521
|
}
|
|
@@ -332,6 +332,48 @@ conditional {
|
|
|
332
332
|
|
|
333
333
|
---
|
|
334
334
|
|
|
335
|
+
## Syntax a Pull Writes
|
|
336
|
+
|
|
337
|
+
### Disabled Statements
|
|
338
|
+
|
|
339
|
+
A leading `!` disables a statement, an `elseif` branch or a switch `case`: it stays in the stack but never runs. A pull writes disabled ones this way.
|
|
340
|
+
|
|
341
|
+
```xs
|
|
342
|
+
!debug.log { value = "skipped" }
|
|
343
|
+
|
|
344
|
+
switch ($input.status) {
|
|
345
|
+
case ("active") {
|
|
346
|
+
var $message { value = "User is active" }
|
|
347
|
+
} break
|
|
348
|
+
!case ("legacy") {
|
|
349
|
+
var $message { value = "Legacy status" }
|
|
350
|
+
} break
|
|
351
|
+
default {
|
|
352
|
+
var $message { value = "Unknown status" }
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Quoting Text
|
|
358
|
+
|
|
359
|
+
`'...'` strings are valid, including for `description`, `docs`, `instructions`, `title`, `tags` and enum `values`; a pull writes a value that contains `"` that way. `"""` blocks hold multiline text.
|
|
360
|
+
|
|
361
|
+
```xs
|
|
362
|
+
function "greet" {
|
|
363
|
+
description = 'Says "hello" to the caller'
|
|
364
|
+
input {
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
stack {
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
response = null
|
|
371
|
+
tags = ['greeting', 'say "hi"']
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
335
377
|
## Common Patterns
|
|
336
378
|
|
|
337
379
|
### 1. Input Validation
|
|
@@ -579,20 +621,7 @@ db.query "dad_jokes" {
|
|
|
579
621
|
} as $joke
|
|
580
622
|
```
|
|
581
623
|
|
|
582
|
-
### 10. Using
|
|
583
|
-
```xs
|
|
584
|
-
// Wrong - $env not allowed in input blocks
|
|
585
|
-
// run.job "my_job" { input { text api_key = $env.API_KEY } }
|
|
586
|
-
|
|
587
|
-
// Correct - access $env in the stack instead
|
|
588
|
-
run.job "my_job" {
|
|
589
|
-
stack {
|
|
590
|
-
var $api_key { value = $env.API_KEY }
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
### 11. Using `object` type without schema
|
|
624
|
+
### 10. Using `object` type without schema
|
|
596
625
|
```xs
|
|
597
626
|
// Wrong - object requires a schema
|
|
598
627
|
// input { object data }
|
|
@@ -613,7 +642,7 @@ input {
|
|
|
613
642
|
}
|
|
614
643
|
```
|
|
615
644
|
|
|
616
|
-
###
|
|
645
|
+
### 11. While loop outside of stack block
|
|
617
646
|
```xs
|
|
618
647
|
// Wrong - while must be inside stack
|
|
619
648
|
// while (true) { each { ... } }
|
|
@@ -626,7 +655,7 @@ stack {
|
|
|
626
655
|
}
|
|
627
656
|
```
|
|
628
657
|
|
|
629
|
-
###
|
|
658
|
+
### 12. Multiple constructs in one file
|
|
630
659
|
|
|
631
660
|
Each `.xs` file must contain exactly **one** construct. Placing two constructs in the same file causes a parse error.
|
|
632
661
|
|
|
@@ -640,7 +669,7 @@ Each `.xs` file must contain exactly **one** construct. Placing two constructs i
|
|
|
640
669
|
// function/helper_b.xs -> contains only "helper_b"
|
|
641
670
|
```
|
|
642
671
|
|
|
643
|
-
###
|
|
672
|
+
### 13. Using `image?` for file uploads (the `.path` footgun)
|
|
644
673
|
|
|
645
674
|
Upload inputs **must** be typed `file?`. `image?`/`attachment?`/`video?`/`audio?` pass the raw upload object (which has `tmp_name` but no `.path`), so `storage.*` fails at runtime with `Missing param: path`. The validator does **not** catch this — it is syntactically valid.
|
|
646
675
|
|
|
@@ -666,7 +695,7 @@ stack {
|
|
|
666
695
|
|
|
667
696
|
See `xano_xanoscript_docs({ topic: "file-uploads" })` for the full pattern.
|
|
668
697
|
|
|
669
|
-
###
|
|
698
|
+
### 14. Wrong delete operation names
|
|
670
699
|
|
|
671
700
|
There is no `db.delete`, no `db.delete_all`, and no fluent `db.<table>.query()...delete()`. The parser rejects all three. Pick by scope: one record, many-by-condition, or the whole table.
|
|
672
701
|
|
|
@@ -693,7 +722,7 @@ db.truncate "session" { reset = true }
|
|
|
693
722
|
|
|
694
723
|
See `xano_xanoscript_docs({ topic: "database" })` for all delete operations.
|
|
695
724
|
|
|
696
|
-
###
|
|
725
|
+
### 15. Read-then-edit counters (lost updates)
|
|
697
726
|
|
|
698
727
|
`db.get` → add → `db.edit` races: two concurrent requests both read `5` and write `6`. Use `db.increment` (atomic; negative `value` decrements; guard with `where`, no clamping; the key is `field_name`).
|
|
699
728
|
|
|
@@ -705,6 +734,10 @@ db.increment "product" {
|
|
|
705
734
|
} as $products
|
|
706
735
|
```
|
|
707
736
|
|
|
737
|
+
### 17. `api_key` on `ai.*`, an agent for a one-shot call, or raw media in a file column
|
|
738
|
+
|
|
739
|
+
Xano AI `ai.*` statements bill credits only: no `api_key`/`provider` key. One prompt → one answer is `ai.text.generate`; `ai.agent.run` is for tools or multi-step work. `$result.image`/`.audio` is a temporary file resource (saves `null` in a file column) unless `save_to_files = "public"`: the key then holds the stored file. Or store a `storage.create_image`/`_audio`/`_video` result. Topic: `ai`.
|
|
740
|
+
|
|
708
741
|
---
|
|
709
742
|
|
|
710
743
|
## Validation is syntax-only
|
|
@@ -725,5 +758,6 @@ Explore more with `xano_xanoscript_docs({ topic: "<topic>" })`:
|
|
|
725
758
|
| `functions` | Reusable function stacks, async patterns, loops |
|
|
726
759
|
| `apis` | HTTP endpoints, authentication, CRUD patterns |
|
|
727
760
|
| `file-uploads` | Uploading files to Xano storage (`file?`, create_attachment, signed URLs) |
|
|
761
|
+
| `ai` | Xano AI statements: generate text/images/video/speech/music, transcribe, embed, rerank |
|
|
728
762
|
| `security` | Security best practices and authentication |
|
|
729
763
|
| `integrations` | External API patterns (OpenAI, Stripe, etc.) |
|
|
@@ -21,7 +21,7 @@ This topic covers uploading files **to Xano's own private/public storage** (the
|
|
|
21
21
|
| Viewing a **private** file | `storage.sign_private_url` (pathname + ttl, one arg per line) | reading `.path` directly (returns HTTP 403) |
|
|
22
22
|
| Viewing a **public** file | instance base URL `~ $stored_file.path` (no signing) | `storage.sign_private_url` (works but is unnecessary) |
|
|
23
23
|
| Multiple-file form field | append as `field[]` (e.g. `photos[]`) | append repeatedly as `photos` (only the last file is kept) |
|
|
24
|
-
| Required `storage.*` args |
|
|
24
|
+
| Required `storage.*` args | pass `value` and `access` (`filename` is optional) | omitting `access` on `create_attachment`/`create_image` (validation error) |
|
|
25
25
|
| Frontend `Content-Type` | let the browser set it | manually setting `multipart/form-data` |
|
|
26
26
|
|
|
27
27
|
## The Core Rule: `file?`, not `image?`
|
|
@@ -53,7 +53,7 @@ file[] my_files
|
|
|
53
53
|
|
|
54
54
|
## Storage Operations
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
`storage.create_attachment` and `storage.create_image` require `value` and `access`; `filename` is optional on every `storage.create_*` (a pull omits it when unset), and `access` is optional on `create_audio` and `create_video`. Write one argument per line (block arguments are newline-separated; commas are only used inside object literals like `data = { ... }`).
|
|
57
57
|
|
|
58
58
|
### `storage.create_attachment` — any file type (recommended default)
|
|
59
59
|
|
|
@@ -383,7 +383,7 @@ storage.create_attachment {
|
|
|
383
383
|
} as $f
|
|
384
384
|
```
|
|
385
385
|
|
|
386
|
-
❌ **Omitting `access
|
|
386
|
+
❌ **Omitting `access`** — `storage.create_attachment { value = $input.photo } as $f` fails validation with `Missing required argument 'access'`.
|
|
387
387
|
|
|
388
388
|
❌ **Comma-separated or commented op args** — `storage.create_attachment { value = ..., filename = ... }` and a comment inside the `{ }` are both parse errors. One argument per line, comments on their own line outside the block.
|
|
389
389
|
|
|
@@ -393,7 +393,7 @@ storage.create_attachment {
|
|
|
393
393
|
|-------|--------|-------|-----|
|
|
394
394
|
| `Missing param: path` (`ERROR_CODE_INPUT_ERROR`, `payload.param` ends in `.path`) | 400 | Input declared `image?`/`video?`/`audio?`/`attachment?` — Xano doesn't set `.path` on the raw upload object | Change input type to `file?` |
|
|
395
395
|
| `Invalid file extension.` (`ERROR_FATAL`) | 500 | `storage.create_image` with a non-image (PDF, HEIC, …) | Use `storage.create_attachment` |
|
|
396
|
-
| `Missing required argument 'access'` (validation, at push time) | — | A `storage.
|
|
396
|
+
| `Missing required argument 'access'` (validation, at push time) | — | A `storage.create_attachment` or `storage.create_image` call omitted `access` | Pass `value` and `access` |
|
|
397
397
|
| HTTP 403 when fetching a file's `.path` | 403 | The file is `private`; raw paths aren't public | Generate `storage.sign_private_url`, or store the file as `public` |
|
|
398
398
|
| Multiple upload stored only one file | — | Multipart field appended without the `[]` suffix | Append files as `field[]` (e.g. `photos[]`) |
|
|
399
399
|
|
|
@@ -150,7 +150,7 @@ the server is exported.
|
|
|
150
150
|
|
|
151
151
|
## Prompts and Resources Blocks
|
|
152
152
|
|
|
153
|
-
First-class prompts (`
|
|
153
|
+
First-class prompts (pulled to `prompt/`) and resources (pulled to `resource/`) are attached the same way as tools. These blocks exist on `mcp_server` only; an `agent` cannot have them.
|
|
154
154
|
|
|
155
155
|
```xs
|
|
156
156
|
mcp_server "Orders" {
|
|
@@ -164,7 +164,7 @@ mcp_server "Orders" {
|
|
|
164
164
|
}
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
Each entry takes `name` (required, the
|
|
167
|
+
Each entry takes `name` (required, the prompt or resource declaration name), `active` (default `true`) and `auth` (an auth-enabled table name; omitted = public). A client only sees, fetches and completes the prompts and resources attached to the server it connected to.
|
|
168
168
|
|
|
169
169
|
---
|
|
170
170
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
applyTo: "ai/prompt/*.xs"
|
|
2
|
+
applyTo: "ai/prompt/*.xs, prompt/**/*.xs"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Prompts
|
|
@@ -80,6 +80,8 @@ prompt code_review {
|
|
|
80
80
|
|
|
81
81
|
An input field that is required and has no default becomes a required prompt argument. A client that omits one gets an error before the stack runs.
|
|
82
82
|
|
|
83
|
+
Without its own `middleware` block, a prompt reached through an MCP server uses that server's middleware, as a tool does. Past the server it uses the branch's `prompt` middleware (see `branch`). Without its own `history` setting, it follows the server's history override, then the branch's `prompt` history setting.
|
|
84
|
+
|
|
83
85
|
---
|
|
84
86
|
|
|
85
87
|
## What `response` May Return
|
|
@@ -137,7 +139,7 @@ mcp_server "Engineering" {
|
|
|
137
139
|
|
|
138
140
|
| Entry field | Purpose | Default |
|
|
139
141
|
|-------------|---------|---------|
|
|
140
|
-
| `name` |
|
|
142
|
+
| `name` | The prompt's declaration name (`prompt code_review`) | (required) |
|
|
141
143
|
| `active` | Whether this server offers the prompt | `true` |
|
|
142
144
|
| `auth` | Name of an auth-enabled table whose token is required to fetch it | omitted = public |
|
|
143
145
|
|