@xano/developer-mcp 2.3.0-beta.3 → 2.3.0-beta.5

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 (42) hide show
  1. package/README.md +4 -14
  2. package/dist/cli_docs/index.js +0 -4
  3. package/dist/cli_docs/topics/function.js +0 -2
  4. package/dist/cli_docs/topics/knowledge.js +1 -2
  5. package/dist/cli_docs/topics/workspace.js +23 -12
  6. package/dist/meta_api_docs/index.js +0 -2
  7. package/dist/meta_api_docs/topics/api.js +6 -6
  8. package/dist/meta_api_docs/topics/apigroup.js +2 -2
  9. package/dist/meta_api_docs/topics/authentication.js +1 -1
  10. package/dist/meta_api_docs/topics/history.js +39 -10
  11. package/dist/meta_api_docs/topics/mcp_server.js +6 -6
  12. package/dist/meta_api_docs/topics/middleware.js +1 -1
  13. package/dist/meta_api_docs/topics/table.js +2 -2
  14. package/dist/meta_api_docs/topics/workspace.js +1 -1
  15. package/dist/tools/validate_xanoscript.js +6 -9
  16. package/dist/xanoscript.js +0 -1
  17. package/dist/xanoscript_docs/README.md +24 -8
  18. package/dist/xanoscript_docs/branch.md +109 -29
  19. package/dist/xanoscript_docs/database.md +7 -5
  20. package/dist/xanoscript_docs/docs_index.json +10 -14
  21. package/dist/xanoscript_docs/essentials.md +42 -0
  22. package/dist/xanoscript_docs/file-uploads.md +4 -4
  23. package/dist/xanoscript_docs/mcp-servers.md +2 -2
  24. package/dist/xanoscript_docs/prompts.md +4 -2
  25. package/dist/xanoscript_docs/realtime-v2.md +4 -2
  26. package/dist/xanoscript_docs/resources.md +3 -1
  27. package/dist/xanoscript_docs/survival.md +1 -5
  28. package/dist/xanoscript_docs/tables.md +58 -0
  29. package/dist/xanoscript_docs/tools.md +1 -1
  30. package/dist/xanoscript_docs/triggers.md +133 -3
  31. package/dist/xanoscript_docs/types.md +14 -1
  32. package/dist/xanoscript_docs/version.json +2 -2
  33. package/dist/xanoscript_docs/workflow-tests.md +18 -0
  34. package/dist/xanoscript_docs/working.md +0 -5
  35. package/package.json +2 -3
  36. package/dist/cli_docs/topics/policy.d.ts +0 -2
  37. package/dist/cli_docs/topics/policy.js +0 -92
  38. package/dist/cli_docs/topics/skills.d.ts +0 -2
  39. package/dist/cli_docs/topics/skills.js +0 -57
  40. package/dist/meta_api_docs/topics/policy.d.ts +0 -3
  41. package/dist/meta_api_docs/topics/policy.js +0 -140
  42. package/dist/xanoscript_docs/policies.md +0 -322
@@ -20,12 +20,17 @@ XanoScript is the declarative scripting language for [Xano](https://xano.com), a
20
20
  | `agent_trigger` | `ai/agent/trigger/{name}.xs` | Agent event handlers |
21
21
  | `tool` | `ai/tool/{name}.xs` | Tools for AI agents |
22
22
  | `mcp_server` | `ai/mcp_server/{name}.xs` | MCP server definitions |
23
- | `prompt` | `ai/prompt/{name}.xs` | MCP prompts |
24
- | `resource` | `ai/resource/{name}.xs` | MCP resources |
23
+ | `prompt` | `prompt/{name}.xs` | MCP prompts |
24
+ | `resource` | `resource/{name}.xs` | MCP resources |
25
25
  | `mcp_server_trigger`| `ai/mcp_server/trigger/{name}.xs` | MCP server event handlers |
26
26
  | `workflow_test` | `workflow_test/{name}.xs` | End-to-end workflow tests |
27
- | `realtime_channel` | `realtime/channel/{name}.xs` | Realtime channel settings |
28
- | `realtime_trigger` | `realtime/trigger/{name}.xs` | Realtime event handlers |
27
+ | `realtime_server` | `realtime/server/{server}/{server}.xs` | Realtime V2 server |
28
+ | `realtime_server_trigger` | `realtime/server/{server}/trigger/{name}.xs` | Realtime V2 connect/disconnect handlers |
29
+ | `channel` | `realtime/server/{server}/channel/{channel}/{channel}.xs` | Realtime V2 channel |
30
+ | `message` | `realtime/server/{server}/channel/{channel}/message/{name}.xs` | Realtime V2 message handlers |
31
+ | `channel_trigger` | `realtime/server/{server}/channel/{channel}/trigger/{name}.xs` | Realtime V2 join/leave/deliver handlers |
32
+ | `realtime_channel` | `realtime/channel/{name}.xs` | Legacy V1 realtime channel settings |
33
+ | `realtime_trigger` | `realtime/trigger/{name}.xs` | Legacy V1 realtime event handlers |
29
34
  | `branch` | `branch.xs` | Branch-level configuration |
30
35
 
31
36
  **Naming convention:** All folder and file names use `snake_case` (e.g., `user_profile.xs`, `get_all_users_get.xs`).
@@ -72,6 +77,10 @@ project/
72
77
  │ ├── my_server.xs # MCP server definitions
73
78
  │ └── trigger/
74
79
  │ └── on_connect.xs # MCP server triggers
80
+ ├── prompt/
81
+ │ └── code_review.xs # MCP prompts
82
+ ├── resource/
83
+ │ └── order_docs.xs # MCP resources
75
84
  ├── workflow_test/
76
85
  │ └── checkout_flow.xs # End-to-end workflow tests
77
86
  ├── middleware/
@@ -79,10 +88,18 @@ project/
79
88
  ├── addon/
80
89
  │ └── user_posts.xs # Query addons
81
90
  ├── realtime/
91
+ │ ├── server/
92
+ │ │ └── chat/
93
+ │ │ ├── chat.xs # Realtime V2 server
94
+ │ │ └── channel/
95
+ │ │ └── rooms_room_id/ # Channel "rooms/{room_id}"
96
+ │ │ ├── rooms_room_id.xs
97
+ │ │ └── message/
98
+ │ │ └── send.xs # Realtime V2 messages
82
99
  │ ├── channel/
83
- │ │ └── chat_room.xs # Realtime channels
100
+ │ │ └── chat_room.xs # Legacy V1 realtime channels
84
101
  │ └── trigger/
85
- │ └── on_message.xs # Realtime triggers
102
+ │ └── on_message.xs # Legacy V1 realtime triggers
86
103
  ├── static/ # Frontend files (HTML, CSS, JS)
87
104
  └── run/ # Job and service configurations
88
105
  ```
@@ -268,8 +285,7 @@ Use `xano_xanoscript_docs({ tier: "survival" })` or `xano_xanoscript_docs({ tier
268
285
  | ------------ | ---------------------------------------------------------------------- | ------------ |
269
286
  | `workspace` | Workspace-level settings: environment variables, preferences, realtime | Env Variables, Preferences |
270
287
  | `branch` | Branch-level settings: middleware, history retention, visual styling | Middleware Config, History |
271
- | `middleware` | Request/response interceptors for functions, queries, tasks, and tools | Pre/Post Hooks |
272
- | `policies` | Workspace policy documents: syntax, check catalogue, templates, authoring rules | Quick Reference, Permissions |
288
+ | `middleware` | Request/response interceptors for functions, queries, tasks, tools, realtime messages, and MCP prompts and resources | Pre/Post Hooks |
273
289
 
274
290
  ### Development
275
291
 
@@ -20,10 +20,12 @@ branch "<name>" {
20
20
  ### Attributes
21
21
  | Attribute | Type | Required | Description |
22
22
  |-----------|------|----------|-------------|
23
- | `color` | text | Yes | Hex color code for branch identification |
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 | No | Pre/post middleware configuration |
26
- | `history` | object | No | Request history retention settings |
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. The policy check
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
  ---
@@ -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,7 +113,7 @@
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
  },
@@ -141,14 +141,14 @@
141
141
  "prompts": {
142
142
  "file": "prompts.md",
143
143
  "description": "MCP prompts: reusable prompt templates an MCP server offers, with arguments and completions",
144
- "applyTo": ["ai/prompt/*.xs"],
144
+ "applyTo": ["ai/prompt/*.xs", "prompt/**/*.xs"],
145
145
  "priority": 3,
146
146
  "aliases": ["prompt", "mcp-prompts"]
147
147
  },
148
148
  "resources": {
149
149
  "file": "resources.md",
150
150
  "description": "MCP resources: static and URI-template resources an MCP server shares as context",
151
- "applyTo": ["ai/resource/*.xs"],
151
+ "applyTo": ["ai/resource/*.xs", "resource/**/*.xs"],
152
152
  "priority": 3,
153
153
  "aliases": ["resource", "mcp-resources", "resource-templates"]
154
154
  },
@@ -258,7 +258,10 @@
258
258
  "channel/**/*.xs",
259
259
  "message/**/*.xs",
260
260
  "channel_trigger/**/*.xs",
261
- "realtime_server_trigger/**/*.xs"
261
+ "realtime_server_trigger/**/*.xs",
262
+ "realtime/server/**/*.xs",
263
+ "realtime/channel_trigger/*.xs",
264
+ "realtime/server_trigger/*.xs"
262
265
  ],
263
266
  "priority": 3,
264
267
  "aliases": [
@@ -302,14 +305,6 @@
302
305
  "applyTo": ["workspace/**/*.xs"],
303
306
  "priority": 3,
304
307
  "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
308
  }
314
309
  },
315
310
 
@@ -384,6 +379,7 @@
384
379
  "workspace_trigger": { "file": "triggers.md", "section": "workspace-trigger" },
385
380
  "agent_trigger": { "file": "triggers.md", "section": "agent-trigger" },
386
381
  "mcp_server_trigger": { "file": "triggers.md", "section": "mcp-server-trigger" },
382
+ "error_trigger": { "file": "triggers.md", "section": "error-trigger" },
387
383
  "addon": { "file": "addons.md" },
388
384
  "middleware": { "file": "middleware.md" },
389
385
  "realtime_channel": { "file": "realtime.md" },
@@ -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
@@ -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 | always pass `value`, `access`, **and** `filename` | omitting `access` or `filename` (validation error) |
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
- All `storage.create_*` operations require three arguments — `value`, `access`, and `filename` — written one per line (block arguments are newline-separated; commas are only used inside object literals like `data = { ... }`).
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` or `filename`** — `storage.create_attachment { value = $input.photo } as $f` fails validation with `Missing required argument 'access'`. Always pass all three.
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.create_*` call omitted `access` (or `filename`) | Pass `value`, `access`, and `filename` |
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 (`ai/prompt/`) and resources (`ai/resource/`) are attached the same way as tools. These blocks exist on `mcp_server` only; an `agent` cannot have them.
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 file 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.
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` | Prompt file name in `ai/prompt/` | (required) |
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
 
@@ -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 pull under `realtime_server/`, `channel/`, `message/`, and `channel_trigger/`. Keep explicit parent clauses: folder names do not replace them.
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
@@ -156,10 +156,6 @@ input {
156
156
  }
157
157
  ```
158
158
 
159
- ### Workspace policies
160
-
161
- If the project has a `policies/` folder, the branch has governance policies. Keep to the active blocking ones while you write code (their findings block merges), then evaluate after changing code: `xano policy evaluate`, the `policy_check` a `xano workspace push` returns, or `xano_evaluate_policies`. `topic: "policies"` has the details.
162
-
163
159
  ### Available Topics
164
160
 
165
- 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, policies
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